]> git.lizzy.rs Git - rust.git/blob - tests/ui/span/regions-escape-loop-via-vec.stderr
Optimize `TyKind::eq`.
[rust.git] / tests / 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    |                       ------ `x` is borrowed 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    |                       ------ `x` is borrowed 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 |         let mut z = x;
27    |             ----- binding `z` declared here
28 LL |         _y.push(&mut z);
29    |                 ^^^^^^ borrowed value does not live long enough
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    |                       ------ `x` is borrowed here
39 ...
40 LL |         _y.push(&mut z);
41    |         --------------- borrow later used here
42 LL |
43 LL |         x += 1;
44    |         ^^^^^^ use of borrowed `x`
45
46 error: aborting due to 4 previous errors
47
48 Some errors have detailed explanations: E0503, E0597.
49 For more information about an error, try `rustc --explain E0503`.