Closed
Description
fn main() {
let mut s: (i32, i32);
s.0 = 3;
s.1 = 4;
println!("{} {}", s.0, s.1);
}
Causes the following warning:
warning: variable does not need to be mutable
--> src/main.rs:2:9
|
2 | let mut s: (i32, i32);
| ----^
| |
| help: remove this `mut`
|
= note: #[warn(unused_mut)] on by default
Removing mut
causes an error:
error[E0594]: cannot assign to `s.0`, as `s` is not declared as mutable
--> src/main.rs:3:5
|
2 | let s: (i32, i32);
| - help: consider changing this to be mutable: `mut s`
3 | s.0 = 3;
| ^^^^^^^ cannot assign
error[E0594]: cannot assign to `s.1`, as `s` is not declared as mutable
--> src/main.rs:4:5
|
2 | let s: (i32, i32);
| - help: consider changing this to be mutable: `mut s`
3 | s.0 = 3;
4 | s.1 = 4;
| ^^^^^^^ cannot assign
error: aborting due to 2 previous errors
Tested on nightly on the playground. This code is stupid, but I don't think it should report "unused mut" warnings.