summary refs log tree commit diff
path: root/src/test/run-pass/vec-matching-legal-tail-element-borrow.rs
blob: aae287deb8a1e56b85c3241daaa49bee3ae8ac81 (plain)
1
2
3
4
5
6
7
8
9
10
pub fn main() {
    let x = &[1, 2, 3, 4, 5];
    if !x.is_empty() {
        let el = match x {
            [1, ..ref tail] => &tail[0],
            _ => ::std::util::unreachable()
        };
        println(fmt!("%d", *el));
    }
}