summary refs log tree commit diff
path: root/src/test/compile-fail/borrowck-vec-pattern-nesting.rs
blob: 81f052918edd8cdbdda8f8544e08384e676245ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
fn a() {
    let mut vec = [~1, ~2, ~3];
    match vec {
        [~ref _a] => {
            vec[0] = ~4; //~ ERROR cannot assign to `vec[]` because it is borrowed
        }
        _ => fail!("foo")
    }
}

fn b() {
    let mut vec = [~1, ~2, ~3];
    match vec {
        [.._b] => {
            vec[0] = ~4; //~ ERROR cannot assign to `vec[]` because it is borrowed
        }
    }
}

fn main() {}