]> git.lizzy.rs Git - rust.git/blob - src/test/ui/closures/issue-80313-mutation-in-move-closure.stderr
Auto merge of #84267 - dtolnay:ptrunit, r=nagisa
[rust.git] / src / test / ui / closures / issue-80313-mutation-in-move-closure.stderr
1 error[E0596]: cannot borrow `callback` as mutable, as it is not declared as mutable
2   --> $DIR/issue-80313-mutation-in-move-closure.rs:6:5
3    |
4 LL |     let callback = move || {
5    |         -------- help: consider changing this to be mutable: `mut callback`
6 LL |         my_var = true;
7    |         ------ calling `callback` requires mutable binding due to possible mutation of `my_var`
8 LL |     };
9 LL |     callback();
10    |     ^^^^^^^^ cannot borrow as mutable
11
12 error: aborting due to previous error
13
14 For more information about this error, try `rustc --explain E0596`.