Closed
Description
fn foo(mut f: Box<FnMut()>) {
f();
}
fn main() {
let y = true;
foo(Box::new(move || y = false) as Box<_>);
}
produces
error: cannot assign to captured outer variable in an `FnMut` closure
--> test.rs:7:26
|
7 | foo(Box::new(move || y = false) as Box<_>);
| ^^^^^^^^^
error: aborting due to previous error
but should produce
error: cannot assign to captured outer variable in an `FnMut` closure
--> test.rs:7:26
|
6 | let y = true;
| - use `mut y` here to make mutable
7 | foo(Box::new(move || y = false) as Box<_>);
| ^^^^^^^^^
error: aborting due to previous error
cc @estebank, you implemented a similar change for moves: #41523.