Closed
Description
fn main() {
let y = 3;
let y = y + 4;
this code compiles fine, but if I try to use something like let y += 4; rustc has no idea what is going on:
fn main() {
let y = 3;
let y += 4;
}
Compiling mul v0.1.0 (file:///tmp/mul)
error: expected one of `:`, `;`, `=`, or `@`, found `+=`
--> src/main.rs:3:11
|
3 | let y += 4;
| ^^ expected one of `:`, `;`, `=`, or `@` here
error: aborting due to previous error
I wonder if we could figure out that the user wants let y = y + 4
in this case and suggest it?
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: The lexing & parsing of Rust source code to an ASTArea: Suggestions generated by the compiler applied by `cargo fix`Category: An issue proposing an enhancement or a PR with one.Diagnostics: An error or lint that needs small tweaks.Relevant to the compiler team, which will review and decide on the PR/issue.