]> git.lizzy.rs Git - rust.git/blob - src/test/ui/span/regions-escape-loop-via-vec.nll.stderr
Rollup merge of #52695 - oli-obk:const_err_panic, r=petrochenkov
[rust.git] / src / test / ui / span / regions-escape-loop-via-vec.nll.stderr
1 error[E0503]: cannot use `x` because it was mutably borrowed
2   --> $DIR/regions-escape-loop-via-vec.rs:15:11
3    |
4 LL |     let mut _y = vec![&mut x];
5    |                       ------ borrow of `x` occurs here
6 LL |     while x < 10 { //~ ERROR cannot use `x` because it was mutably borrowed
7    |           ^ use of borrowed `x`
8 LL |         let mut z = x; //~ ERROR cannot use `x` because it was mutably borrowed
9 LL |         _y.push(&mut z);
10    |         -- borrow later used here
11
12 error[E0503]: cannot use `x` because it was mutably borrowed
13   --> $DIR/regions-escape-loop-via-vec.rs:16:21
14    |
15 LL |     let mut _y = vec![&mut x];
16    |                       ------ borrow of `x` occurs here
17 LL |     while x < 10 { //~ ERROR cannot use `x` because it was mutably borrowed
18 LL |         let mut z = x; //~ ERROR cannot use `x` because it was mutably borrowed
19    |                     ^ use of borrowed `x`
20 LL |         _y.push(&mut z);
21    |         -- borrow later used here
22
23 error[E0503]: cannot use `x` because it was mutably borrowed
24   --> $DIR/regions-escape-loop-via-vec.rs:19:9
25    |
26 LL |     let mut _y = vec![&mut x];
27    |                       ------ borrow of `x` occurs here
28 ...
29 LL |         _y.push(&mut z);
30    |         -- borrow later used here
31 LL |         //~^ ERROR `z` does not live long enough
32 LL |         x += 1; //~ ERROR cannot assign
33    |         ^^^^^^ use of borrowed `x`
34
35 error[E0597]: `z` does not live long enough
36   --> $DIR/regions-escape-loop-via-vec.rs:17:17
37    |
38 LL |         _y.push(&mut z);
39    |         --      ^^^^^^ borrowed value does not live long enough
40    |         |
41    |         borrow later used here
42 ...
43 LL |     }
44    |     - `z` dropped here while still borrowed
45
46 error: aborting due to 4 previous errors
47
48 Some errors occurred: E0503, E0597.
49 For more information about an error, try `rustc --explain E0503`.