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