2019-11-21 18:45:28 +00:00
|
|
|
#![feature(or_patterns)]
|
2019-12-30 01:23:42 +01:00
|
|
|
|
2019-11-25 18:23:09 +00:00
|
|
|
#![allow(incomplete_features)]
|
2019-11-21 18:45:28 +00:00
|
|
|
#![deny(unreachable_patterns)]
|
|
|
|
|
2019-11-26 14:53:54 +00:00
|
|
|
// We wrap patterns in a tuple because top-level or-patterns are special-cased for now.
|
2019-11-21 18:45:28 +00:00
|
|
|
fn main() {
|
2019-11-26 14:32:47 +00:00
|
|
|
// Get the fatal error out of the way
|
|
|
|
match (0u8,) {
|
|
|
|
(0 | _,) => {}
|
|
|
|
//~^ ERROR or-patterns are not fully implemented yet
|
|
|
|
}
|
|
|
|
|
2019-11-21 18:45:28 +00:00
|
|
|
match (0u8,) {
|
|
|
|
(1 | 2,) => {}
|
|
|
|
(1,) => {} //~ ERROR unreachable pattern
|
|
|
|
_ => {}
|
|
|
|
}
|
|
|
|
match (0u8,) {
|
|
|
|
(1 | 2,) => {}
|
|
|
|
(2,) => {} //~ ERROR unreachable pattern
|
|
|
|
_ => {}
|
|
|
|
}
|
|
|
|
match (0u8,) {
|
|
|
|
(1,) => {}
|
|
|
|
(2,) => {}
|
|
|
|
(1 | 2,) => {} //~ ERROR unreachable pattern
|
|
|
|
_ => {}
|
|
|
|
}
|
|
|
|
match (0u8, 0u8) {
|
|
|
|
(1 | 2, 3 | 4) => {}
|
|
|
|
(1, 3) => {} //~ ERROR unreachable pattern
|
|
|
|
(1, 4) => {} //~ ERROR unreachable pattern
|
|
|
|
(2, 4) => {} //~ ERROR unreachable pattern
|
|
|
|
(2 | 1, 4) => {} //~ ERROR unreachable pattern
|
2019-11-26 14:53:54 +00:00
|
|
|
(1, 5 | 6) => {}
|
|
|
|
(1, 4 | 5) => {} //~ ERROR unreachable pattern
|
2019-11-21 18:45:28 +00:00
|
|
|
_ => {}
|
|
|
|
}
|
2019-11-21 19:06:49 +00:00
|
|
|
match (Some(0u8),) {
|
|
|
|
(None | Some(1 | 2),) => {}
|
|
|
|
(Some(1),) => {} //~ ERROR unreachable pattern
|
|
|
|
(None,) => {} //~ ERROR unreachable pattern
|
2019-11-26 14:53:54 +00:00
|
|
|
_ => {}
|
2019-11-21 19:06:49 +00:00
|
|
|
}
|
|
|
|
match ((0u8,),) {
|
|
|
|
((1 | 2,) | (3 | 4,),) => {},
|
|
|
|
((1..=4,),) => {}, //~ ERROR unreachable pattern
|
2019-11-26 14:53:54 +00:00
|
|
|
_ => {},
|
2019-11-25 18:23:09 +00:00
|
|
|
}
|
2019-11-29 13:02:14 +00:00
|
|
|
|
|
|
|
match (0,) {
|
|
|
|
(1
|
|
|
|
| 1,) => {} //~ ERROR unreachable
|
|
|
|
_ => {}
|
|
|
|
}
|
|
|
|
match [0; 2] {
|
|
|
|
[0
|
|
|
|
| 0 //~ ERROR unreachable
|
|
|
|
, 0
|
|
|
|
| 0] => {} //~ ERROR unreachable
|
|
|
|
_ => {}
|
|
|
|
}
|
|
|
|
match &[][..] {
|
|
|
|
[0] => {}
|
|
|
|
[0, _] => {}
|
|
|
|
[0, _, _] => {}
|
|
|
|
[1, ..] => {}
|
|
|
|
[1 //~ ERROR unreachable
|
|
|
|
| 2, ..] => {}
|
|
|
|
_ => {}
|
|
|
|
}
|
|
|
|
match Some(0) {
|
|
|
|
Some(0) => {}
|
|
|
|
Some(0 //~ ERROR unreachable
|
|
|
|
| 1) => {}
|
|
|
|
_ => {}
|
|
|
|
}
|
2019-11-21 18:45:28 +00:00
|
|
|
}
|