mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 15:23:46 +00:00
16 lines
304 B
Rust
16 lines
304 B
Rust
//@ run-pass
|
|
|
|
#![allow(unused_variables)]
|
|
|
|
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);
|
|
}
|
|
}
|