]> git.lizzy.rs Git - rust.git/blob - src/test/ui/span/regions-escape-loop-via-vec.nll.stderr
ea64828fedde65c658968461e2172ce9f1f85d19
[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:5: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 used here, in later iteration of loop
11
12 error[E0503]: cannot use `x` because it was mutably borrowed
13   --> $DIR/regions-escape-loop-via-vec.rs:6: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 used here, in later iteration of loop
22
23 error[E0597]: `z` does not live long enough
24   --> $DIR/regions-escape-loop-via-vec.rs:7:17
25    |
26 LL |         _y.push(&mut z);
27    |         --      ^^^^^^ borrowed value does not live long enough
28    |         |
29    |         borrow used here, in later iteration of loop
30 ...
31 LL |     }
32    |     - `z` dropped here while still borrowed
33
34 error[E0503]: cannot use `x` because it was mutably borrowed
35   --> $DIR/regions-escape-loop-via-vec.rs:9:9
36    |
37 LL |     let mut _y = vec![&mut x];
38    |                       ------ borrow of `x` occurs here
39 ...
40 LL |         _y.push(&mut z);
41    |         -- borrow used here, in later iteration of loop
42 LL |         //~^ ERROR `z` does not live long enough
43 LL |         x += 1; //~ ERROR cannot assign
44    |         ^^^^^^ use of borrowed `x`
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`.