rust/src/test/ui/span/regions-escape-loop-via-vec.stderr

41 lines
1.5 KiB
Plaintext
Raw Normal View History

2017-05-27 17:58:52 +00:00
error[E0597]: `z` does not live long enough
--> $DIR/regions-escape-loop-via-vec.rs:19:5
|
17 | _y.push(&mut z);
| - borrow occurs here
18 | x += 1; //~ ERROR cannot assign
19 | }
| ^ `z` dropped here while still borrowed
20 | //~^ ERROR `z` does not live long enough
21 | }
| - borrowed value needs to live until here
error[E0503]: cannot use `x` because it was mutably borrowed
--> $DIR/regions-escape-loop-via-vec.rs:15:11
|
14 | let mut _y = vec![&mut x];
| - borrow of `x` occurs here
15 | while x < 10 { //~ ERROR cannot use `x` because it was mutably borrowed
| ^ use of borrowed `x`
error[E0503]: cannot use `x` because it was mutably borrowed
--> $DIR/regions-escape-loop-via-vec.rs:16:13
|
14 | let mut _y = vec![&mut x];
| - borrow of `x` occurs here
15 | while x < 10 { //~ ERROR cannot use `x` because it was mutably borrowed
16 | let mut z = x; //~ ERROR cannot use `x` because it was mutably borrowed
| ^^^^^ use of borrowed `x`
error[E0506]: cannot assign to `x` because it is borrowed
--> $DIR/regions-escape-loop-via-vec.rs:18:9
|
14 | let mut _y = vec![&mut x];
| - borrow of `x` occurs here
...
18 | x += 1; //~ ERROR cannot assign
| ^^^^^^ assignment to borrowed `x` occurs here
error: aborting due to 4 previous errors