1
Fork 0
rust/src/test/ui/or-patterns/exhaustiveness-pass.rs

46 lines
935 B
Rust
Raw Normal View History

#![feature(or_patterns)]
2019-12-30 01:23:42 +01: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,) {
(0 | _,) => {}
//~^ ERROR or-patterns are not fully implemented yet
}
2019-11-29 12:25:36 +00:00
match (0,) {
(1 | 2,) => {}
_ => {}
}
2019-11-29 12:25:36 +00:00
match (0, 0) {
(1 | 2, 3 | 4) => {}
(1, 2) => {}
2019-11-29 12:25:36 +00:00
(3, 1) => {}
_ => {}
}
match (Some(0u8),) {
(None | Some(0 | 1),) => {}
(Some(2..=255),) => {}
}
2019-11-29 12:25:36 +00:00
match ((0,),) {
((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),) => {}
_ => {}
}
}