mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 15:23:46 +00:00
22 lines
478 B
Rust
22 lines
478 B
Rust
#![feature(box_patterns)]
|
|
#![allow(dead_code)]
|
|
#![allow(unused_variables)]
|
|
#![deny(unreachable_patterns)]
|
|
|
|
|
|
enum IntList {
|
|
Cons(isize, Box<IntList>),
|
|
Nil
|
|
}
|
|
|
|
fn tail(source_list: &IntList) -> IntList {
|
|
match source_list {
|
|
&IntList::Cons(val, box ref next_list) => tail(next_list),
|
|
&IntList::Cons(val, box IntList::Nil) => IntList::Cons(val, Box::new(IntList::Nil)),
|
|
//~^ ERROR unreachable pattern
|
|
_ => panic!(),
|
|
}
|
|
}
|
|
|
|
fn main() {}
|