]> git.lizzy.rs Git - rust.git/blob - src/test/ui/span/regions-escape-loop-via-vec.rs
Rollup merge of #87922 - Manishearth:c-enum-target-spec, r=nagisa,eddyb
[rust.git] / src / test / ui / span / regions-escape-loop-via-vec.rs
1 // The type of `y` ends up getting inferred to the type of the block.
2 fn broken() {
3     let mut x = 3;
4     let mut _y = vec![&mut x];
5     while x < 10 { //~ ERROR cannot use `x` because it was mutably borrowed
6         let mut z = x; //~ ERROR cannot use `x` because it was mutably borrowed
7         _y.push(&mut z);
8         //~^ ERROR `z` does not live long enough
9         x += 1; //~ ERROR cannot use `x` because it was mutably borrowed
10     }
11 }
12
13 fn main() { }