summary refs log tree commit diff
path: root/src/test/ui/array-slice-vec/vec-matching-legal-tail-element-borrow.rs
blob: f0602c328b071af010092e6b513c8970b72ede24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// run-pass
#![allow(unused_variables)]

#![feature(slice_patterns)]

pub fn main() {
    let x = &[1, 2, 3, 4, 5];
    let x: &[isize] = &[1, 2, 3, 4, 5];
    if !x.is_empty() {
        let el = match x {
            &[1, ref tail @ ..] => &tail[0],
            _ => unreachable!()
        };
        println!("{}", *el);
    }
}