File: mut_ref.stderr

package info (click to toggle)
rustc 1.70.0%2Bdfsg1-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 722,120 kB
  • sloc: xml: 147,962; javascript: 10,210; sh: 8,590; python: 8,220; ansic: 5,901; cpp: 4,635; makefile: 4,001; asm: 2,856
file content (26 lines) | stat: -rw-r--r-- 939 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
error[E0596]: cannot borrow `**ref_mref_x` as mutable, as it is behind a `&` reference
  --> $DIR/mut_ref.rs:12:13
   |
LL |     let c = || {
   |             ^^ `ref_mref_x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
LL |
LL |         **ref_mref_x = y;
   |         ------------ mutable borrow occurs due to use of `**ref_mref_x` in closure
   |
help: consider changing this to be a mutable reference
   |
LL |     let ref_mref_x = &mut mref_x;
   |                      ~~~~~~~~~~~

error[E0596]: cannot borrow `**mref_ref_x` as mutable, as it is behind a `&` reference
  --> $DIR/mut_ref.rs:26:13
   |
LL |     let c = || {
   |             ^^ cannot borrow as mutable
LL |
LL |         **mref_ref_x = y;
   |         ------------ mutable borrow occurs due to use of `**mref_ref_x` in closure

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0596`.