about summary refs log tree commit diff
path: root/src/test/compile-fail/regions-escape-loop-via-vec.rs
blob: 309cb0302330e03722290fa51a261381560d380d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// The type of `y` ends up getting inferred to the type of the block.
// This generates a ton of error msgs at the moment.
fn broken() -> int {
    let mut x = 3;
    let mut y = [&mut x]/~; //! ERROR reference is not valid
    while x < 10 {
        let mut z = x;
        y += [&mut z]/~;
        x += 1;
    }
    vec::foldl(0, y) {|v, p| v + *p }
    //!^ ERROR reference is not valid
    //!^^ ERROR reference is not valid
    //!^^^ ERROR reference is not valid
}

fn main() { }