2018-08-30 14:18:55 +02:00
|
|
|
//@ run-pass
|
|
|
|
|
2019-12-30 01:23:42 +01:00
|
|
|
#![allow(unused_variables)]
|
2015-03-26 18:34:27 -07:00
|
|
|
|
2013-02-01 19:43:17 -08:00
|
|
|
pub fn main() {
|
2015-01-25 22:05:03 +01:00
|
|
|
let x = &[1, 2, 3, 4, 5];
|
2015-03-25 17:06:52 -07:00
|
|
|
let x: &[isize] = &[1, 2, 3, 4, 5];
|
2012-12-15 23:13:55 +00:00
|
|
|
if !x.is_empty() {
|
|
|
|
let el = match x {
|
2019-07-08 01:47:46 +02:00
|
|
|
&[1, ref tail @ ..] => &tail[0],
|
2013-09-19 15:04:03 +10:00
|
|
|
_ => unreachable!()
|
2012-12-15 23:13:55 +00:00
|
|
|
};
|
2013-09-24 22:16:43 -07:00
|
|
|
println!("{}", *el);
|
2012-12-15 23:13:55 +00:00
|
|
|
}
|
|
|
|
}
|