fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #68568 - pietroalbini:stable-next, r=pietroalbini5e1a799842b

1.41.0
1.2 KiB32 linesraw
1error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
2  --> $DIR/borrowck-closures-mut-of-imm.rs:9:25
3   |
4LL |     let mut c1 = || set(&mut *x);
5   |                         ^^^^^^^ cannot borrow as mutable
6
7error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
8  --> $DIR/borrowck-closures-mut-of-imm.rs:11:25
9   |
10LL |     let mut c2 = || set(&mut *x);
11   |                         ^^^^^^^ cannot borrow as mutable
12
13error[E0524]: two closures require unique access to `x` at the same time
14  --> $DIR/borrowck-closures-mut-of-imm.rs:11:18
15   |
16LL |     let mut c1 = || set(&mut *x);
17   |                  --           - first borrow occurs due to use of `x` in closure
18   |                  |
19   |                  first closure is constructed here
20LL |
21LL |     let mut c2 = || set(&mut *x);
22   |                  ^^           - second borrow occurs due to use of `x` in closure
23   |                  |
24   |                  second closure is constructed here
25...
26LL |     c2(); c1();
27   |           -- first borrow later used here
28
29error: aborting due to 3 previous errors
30
31Some errors have detailed explanations: E0524, E0596.
32For more information about an error, try `rustc --explain E0524`.