]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/borrowck-closures-mut-of-imm.stderr
Rollup merge of #106644 - alexcrichton:update-wasi-toolchain, r=cuviper
[rust.git] / tests / ui / borrowck / borrowck-closures-mut-of-imm.stderr
1 error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
2   --> $DIR/borrowck-closures-mut-of-imm.rs:9:25
3    |
4 LL |     let mut c1 = || set(&mut *x);
5    |                         ^^^^^^^ cannot borrow as mutable
6
7 error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
8   --> $DIR/borrowck-closures-mut-of-imm.rs:11:25
9    |
10 LL |     let mut c2 = || set(&mut *x);
11    |                         ^^^^^^^ cannot borrow as mutable
12
13 error[E0524]: two closures require unique access to `x` at the same time
14   --> $DIR/borrowck-closures-mut-of-imm.rs:11:18
15    |
16 LL |     let mut c1 = || set(&mut *x);
17    |                  --          -- first borrow occurs due to use of `x` in closure
18    |                  |
19    |                  first closure is constructed here
20 LL |
21 LL |     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 ...
26 LL |     c2(); c1();
27    |           -- first borrow later used here
28
29 error: aborting due to 3 previous errors
30
31 Some errors have detailed explanations: E0524, E0596.
32 For more information about an error, try `rustc --explain E0524`.