Skip to content

Cannot infer type should state how to specify the type #61152

Open
@czipperz

Description

@czipperz

For example:

error[E0282]: type annotations needed
  --> src/os_str_join.rs:54:43
   |
54 |         assert_eq!(OsString::from(""), [].join("-".as_ref()));
   |                                           ^^^^ cannot infer type

Without googling, I have no way of understanding how to annotate my empty array with a type.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-inferenceArea: Type inferenceA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`C-enhancementCategory: An issue proposing an enhancement or a PR with one.D-verboseDiagnostics: Too much output caused by a single piece of incorrect code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions