rust/src/test/compile-fail/borrowck-vec-pattern-move-tail.rs
2013-05-22 21:57:10 -07:00

10 lines
223 B
Rust

fn main() {
let mut a = [1, 2, 3, 4];
let t = match a {
[1, 2, ..tail] => tail,
_ => std::util::unreachable()
};
a[0] = 0; //~ ERROR cannot assign to `a[]` because it is borrowed
t[0];
}