fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #71365 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4fb7144ed15

1.43.0
267 B13 linesraw
1// run-rustfix
2
3// Point at the captured immutable outer variable
4
5fn foo(mut f: Box<dyn FnMut()>) {
6    f();
7}
8
9fn main() {
10    let mut y = true;
11    foo(Box::new(move || y = false) as Box<_>);
12    //~^ ERROR cannot assign to `y`, as it is not declared as mutable
13}