2018-04-02 06:20:06 -05:00
|
|
|
// compile-pass
|
2017-12-10 13:14:01 -06:00
|
|
|
|
2017-07-16 11:34:09 -05:00
|
|
|
#![feature(exclusive_range_pattern)]
|
2017-07-26 23:51:09 -05:00
|
|
|
#![warn(unreachable_patterns)]
|
2017-07-16 11:34:09 -05:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
// These cases should generate no warning.
|
|
|
|
match 10 {
|
|
|
|
1..10 => {},
|
|
|
|
10 => {},
|
|
|
|
_ => {},
|
|
|
|
}
|
|
|
|
|
|
|
|
match 10 {
|
|
|
|
1..10 => {},
|
2018-05-28 21:42:11 -05:00
|
|
|
9..=10 => {},
|
2017-07-16 11:34:09 -05:00
|
|
|
_ => {},
|
|
|
|
}
|
|
|
|
|
|
|
|
match 10 {
|
|
|
|
1..10 => {},
|
2018-05-28 21:42:11 -05:00
|
|
|
10..=10 => {},
|
2017-07-16 11:34:09 -05:00
|
|
|
_ => {},
|
|
|
|
}
|
|
|
|
|
|
|
|
// These cases should generate an "unreachable pattern" warning.
|
|
|
|
match 10 {
|
|
|
|
1..10 => {},
|
|
|
|
9 => {},
|
|
|
|
_ => {},
|
|
|
|
}
|
|
|
|
|
|
|
|
match 10 {
|
|
|
|
1..10 => {},
|
2018-05-28 21:42:11 -05:00
|
|
|
8..=9 => {},
|
2017-07-16 11:34:09 -05:00
|
|
|
_ => {},
|
|
|
|
}
|
|
|
|
|
|
|
|
match 10 {
|
|
|
|
1..10 => {},
|
2018-05-28 21:42:11 -05:00
|
|
|
9..=9 => {},
|
2017-07-16 11:34:09 -05:00
|
|
|
_ => {},
|
|
|
|
}
|
2017-07-26 23:51:09 -05:00
|
|
|
}
|