blob: 1d4911bd5af7384c79c33e2ecf40b7458c30e5bf [file] [log] [blame]
error[E0597]: `z` does not live long enough
--> $DIR/regions-escape-loop-via-vec.rs:17:22
|
LL | _y.push(&mut z);
| ^ borrowed value does not live long enough
...
LL | }
| - `z` dropped here while still borrowed
LL | }
| - 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
|
LL | let mut _y = vec![&mut x];
| - borrow of `x` occurs here
LL | 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
|
LL | let mut _y = vec![&mut x];
| - borrow of `x` occurs here
LL | while x < 10 { //~ ERROR cannot use `x` because it was mutably borrowed
LL | 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:19:9
|
LL | let mut _y = vec![&mut x];
| - borrow of `x` occurs here
...
LL | x += 1; //~ ERROR cannot assign
| ^^^^^^ assignment to borrowed `x` occurs here
error: aborting due to 4 previous errors
Some errors occurred: E0503, E0506, E0597.
For more information about an error, try `rustc --explain E0503`.