blob: 3cb92a54029dc03cdea9190fd3762f139f767f25 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#![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() {}
|