Closed
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.