rust/src/test/run-pass/vec-matching-legal-tail-element-borrow.rs
2013-07-24 09:45:20 -04:00

11 lines
230 B
Rust

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()
};
printfln!("%d", *el);
}
}