Skip to content

Unhelpful diagnostic on = to : typo mentioning return type notation #134087

Open
@oriongonza

Description

@oriongonza

Code

let x: Vec::new();

Current output

error: return type notation arguments must be elided with `..`
 --> src/main.rs:2:20
  |
2 |     let x: Vec::new();
  |                    ^^ help: add `..`: `(..)`

error: return type notation not allowed in this position yet
 --> src/main.rs:2:12
  |
2 |     let x: Vec::new();
  |            ^^^^^^^^^^

Rationale and extra context

This is a mistake where : was used instead of =. Instead of telling the user that it talks about rtn.

Rust Version

stable and latest nightly.
rustc 1.85.0-nightly (a2545fd6f 2024-11-28)

Anything else?

@rustbot label +D-invalid-suggestion

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsD-confusingDiagnostics: Confusing error or lint that should be reworked.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