summaryrefslogtreecommitdiffstats
path: root/tests/ui/borrowck/borrowck-vec-pattern-loan-from-mut.rs
blob: 05859c95d174d9dedc1c5b7dc1d84c80a7fe84f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
fn a() {
    let mut v = vec![1, 2, 3];
    let vb: &mut [isize] = &mut v;
    match vb {
        &mut [_a, ref tail @ ..] => {
            v.push(tail[0] + tail[1]); //~ ERROR cannot borrow
        }
        _ => {}
    };
}

fn main() {}