-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.D-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
For the following program
fn main() {
let v = Vec::new();
v.push(0);
v.push(0);
}
rustc shows two errors:
error[E0596]: cannot borrow immutable local variable `v` as mutable
--> src/main.rs:3:5
|
2 | let v = Vec::new();
| - consider changing this to `mut v`
3 | v.push(0);
| ^ cannot borrow mutably
error[E0596]: cannot borrow immutable local variable `v` as mutable
--> src/main.rs:4:5
|
2 | let v = Vec::new();
| - consider changing this to `mut v`
3 | v.push(0);
4 | v.push(0);
| ^ cannot borrow mutably
error: aborting due to 2 previous errors
These are not exactly the same, but still pretty much a duplicate.
it would be nice if rustc could avoid complaining about the same thing twice here.
estebank
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.D-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.