rust/src/test/run-pass/vec-matching-legal-tail-element-borrow.rs
2013-01-07 18:55:12 -08:00

11 lines
236 B
Rust

fn main() {
let x = &[1, 2, 3, 4, 5];
if !x.is_empty() {
let el = match x {
[1, ..ref tail] => &tail[0],
_ => ::core::util::unreachable()
};
io::println(fmt!("%d", *el));
}
}