Closed
Description
Code
let last = u64 = 0;
let val = u64;
Current output
error[E0423]: expected value, found builtin type `u64`
--> src/main.rs:21:24
|
21 | let last = u64 = 0;
| ^^^
|
help: you might have meant to introduce a new binding
|
21 | let last = let u64 = 0;
| +++
error[E0423]: expected value, found builtin type `u64`
--> src/main.rs:21:20
|
21 | let last = u64;
| ^^^ not a value
Desired output
error[E0423]: expected value, found builtin type `u64`
--> src/main.rs:21:24
|
21 | let last = u64 = 0;
| ^^^
|
help: you might have meant to use `:` instead of `=`
|
21 | let last: u64 = 0;
| +
note: type annotations use `:` instead of `=` (https://doc.rust-lang.org/reference/statements.html#expression-statements)
error[E0423]: expected value, found builtin type `u64`
--> src/main.rs:21:20
|
21 | let last = u64;
| ^^^ not a value
help: you might have meant to use `:` instead of `=`
note: type annotations use `:` instead of `=` (https://doc.rust-lang.org/reference/statements.html#expression-statements)
Rationale and extra context
This is a silly mistake to make and also simple to detect and autofix.
Other cases
Rust Version
1.85.0-nightly (4c39aaff6 2024-11-25)
Anything else?
@rustbot label +D-incorrect +D-confusing +A-parser
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: The lexing & parsing of Rust source code to an ASTDiagnostics: Confusing error or lint that should be reworked.Diagnostics: A diagnostic that is giving misleading or incorrect information.Relevant to the compiler team, which will review and decide on the PR/issue.