Skip to content

Incomplete error message: unable to infer enough type information about _ #25633

Closed
@jruderman

Description

@jruderman
fn main() {
    let a = Vec::new();
}

Gives me:

<anon>:2:13: 2:21 error: unable to infer enough type information about `_`; type annotations required [E0282]
<anon>:2     let a = Vec::new();
                     ^~~~~~~~

This is confusing because it doesn't say what the _ is that it can't figure out. Perhaps it could say something like:

Only able to infer that `a` has type `Vec<_>`; please annotate so I can figure out what `_` is.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.WG-diagnosticsWorking group: Diagnostics

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions