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

10 lines
224 B
Rust
Raw Normal View History

fn main() {
let mut a = [1, 2, 3, 4];
2013-03-15 14:24:24 -05:00
let t = match a {
[1, 2, ..tail] => tail,
_ => core::util::unreachable()
};
2013-03-15 14:24:24 -05:00
a[0] = 0; //~ ERROR cannot assign to `a[]` because it is borrowed
t[0];
}