rust/src/test/compile-fail/borrowck-vec-pattern-loan-from-mut.rs
Niko Matsakis 2e10ea58c3 Integrate vec patterns into borrow checker.
The tail portion of the pattern effectively borrows a vector,
but the borrow checker knew nothing about this.

r=catamorphism
2013-01-28 10:00:32 -08:00

13 lines
202 B
Rust

fn a() {
let mut v = ~[1, 2, 3];
match v {
[_a, ..tail] => {
v.push(tail[0] + tail[1]); //~ ERROR conflicts with prior loan
}
_ => {}
};
}
fn main() {}