]> git.lizzy.rs Git - rust.git/blob - tests/ui/closures/issue-80313-mutable-borrow-in-closure.stderr
Rollup merge of #106797 - FawazTirmizi:dev/issues/104284, r=bjorn3
[rust.git] / tests / ui / closures / issue-80313-mutable-borrow-in-closure.stderr
1 error[E0596]: cannot borrow `callback` as mutable, as it is not declared as mutable
2   --> $DIR/issue-80313-mutable-borrow-in-closure.rs:6:5
3    |
4 LL |         &mut my_var;
5    |              ------ calling `callback` requires mutable binding due to mutable borrow of `my_var`
6 LL |     };
7 LL |     callback();
8    |     ^^^^^^^^ cannot borrow as mutable
9    |
10 help: consider changing this to be mutable
11    |
12 LL |     let mut callback = || {
13    |         +++
14
15 error: aborting due to previous error
16
17 For more information about this error, try `rustc --explain E0596`.