rust/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.rs

15 lines
266 B
Rust
Raw Normal View History

#![feature(slice_patterns)]
fn a() {
let mut v = vec![1, 2, 3];
let vb: &mut [isize] = &mut v;
match vb {
&mut [_a, ref tail..] => {
2013-03-15 14:24:24 -05:00
v.push(tail[0] + tail[1]); //~ ERROR cannot borrow
}
_ => {}
};
}
fn main() {}