]> git.lizzy.rs Git - rust.git/blob - src/test/ui/closures/closure-immutable-outer-variable.fixed
Rollup merge of #93112 - pietroalbini:pa-cve-2022-21658-nightly, r=pietroalbini
[rust.git] / src / test / ui / closures / closure-immutable-outer-variable.fixed
1 // run-rustfix
2
3 // Point at the captured immutable outer variable
4
5 fn foo(mut f: Box<dyn FnMut()>) {
6     f();
7 }
8
9 fn main() {
10     let mut y = true;
11     foo(Box::new(move || y = !y) as Box<_>);
12     //~^ ERROR cannot assign to `y`, as it is not declared as mutable
13 }