Closed
Description
#![feature(nll)]
struct Foo {
pub value: i32
}
// triggers bug
fn use_foo_mut(mut foo: Foo) {
foo = foo;
println!("{}", foo.value);
}
// does not trigger bug
fn use_i32_mut(mut i: i32) {
i = i;
println!("{}", i);
}
fn main() {
use_foo_mut(Foo { value: 413 });
use_i32_mut(413);
}
gives:
warning: variable does not need to be mutable
--> src/main.rs:8:16
|
8 | fn use_foo_mut(mut foo: Foo) {
| ----^^^
| |
| help: remove this `mut`
|
= note: #[warn(unused_mut)] on by default
If I remove the mut then I get a compile error.
Compiled with nightly-2018-05-05
This is not related to #50343 as that has been fixed in the nightly I am using.