]> git.lizzy.rs Git - rust.git/blob - src/test/ui/span/regions-escape-loop-via-vec.stderr
Rollup merge of #106043 - c410-f3r:moar-errors, r=petrochenkov
[rust.git] / src / test / ui / span / regions-escape-loop-via-vec.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 {
7    |           ^ use of borrowed `x`
8 LL |         let mut z = x;
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:6:21
14    |
15 LL |     let mut _y = vec![&mut x];
16    |                       ------ borrow of `x` occurs here
17 LL |     while x < 10 {
18 LL |         let mut z = x;
19    |                     ^ use of borrowed `x`
20 LL |         _y.push(&mut z);
21    |         --------------- borrow later used here
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    |         --------^^^^^^-
28    |         |       |
29    |         |       borrowed value does not live long enough
30    |         borrow later used here
31 ...
32 LL |     }
33    |     - `z` dropped here while still borrowed
34
35 error[E0503]: cannot use `x` because it was mutably borrowed
36   --> $DIR/regions-escape-loop-via-vec.rs:9:9
37    |
38 LL |     let mut _y = vec![&mut x];
39    |                       ------ borrow of `x` occurs here
40 ...
41 LL |         _y.push(&mut z);
42    |         --------------- borrow later used here
43 LL |
44 LL |         x += 1;
45    |         ^^^^^^ use of borrowed `x`
46
47 error: aborting due to 4 previous errors
48
49 Some errors have detailed explanations: E0503, E0597.
50 For more information about an error, try `rustc --explain E0503`.