rust/src/test/compile-fail/borrowck-vec-pattern-nesting.rs

21 lines
400 B
Rust
Raw Normal View History

fn a() {
let mut vec = [~1, ~2, ~3];
match vec {
[~ref _a] => {
2013-03-15 14:24:24 -05:00
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] => {
2013-03-15 14:24:24 -05:00
vec[0] = ~4; //~ ERROR cannot assign to `vec[]` because it is borrowed
}
}
}
fn main() {}