]> git.lizzy.rs Git - rust.git/blob - tests/ui/closures/2229_closure_analysis/diagnostics/mut_ref.stderr
Rollup merge of #107168 - Nilstrieb:if-a-tait-falls-in-the-forest,can-we-know-it...
[rust.git] / tests / ui / closures / 2229_closure_analysis / diagnostics / mut_ref.stderr
1 error[E0596]: cannot borrow `**ref_mref_x` as mutable, as it is behind a `&` reference
2   --> $DIR/mut_ref.rs:12:13
3    |
4 LL |     let c = || {
5    |             ^^ `ref_mref_x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
6 LL |
7 LL |         **ref_mref_x = y;
8    |         ------------ mutable borrow occurs due to use of `**ref_mref_x` in closure
9    |
10 help: consider changing this to be a mutable reference
11    |
12 LL |     let ref_mref_x = &mut mref_x;
13    |                      ~~~~~~~~~~~
14
15 error[E0596]: cannot borrow `**mref_ref_x` as mutable, as it is behind a `&` reference
16   --> $DIR/mut_ref.rs:26:13
17    |
18 LL |     let c = || {
19    |             ^^ cannot borrow as mutable
20 LL |
21 LL |         **mref_ref_x = y;
22    |         ------------ mutable borrow occurs due to use of `**mref_ref_x` in closure
23
24 error: aborting due to 2 previous errors
25
26 For more information about this error, try `rustc --explain E0596`.