]> git.lizzy.rs Git - rust.git/blob - src/test/ui/or-patterns/exhaustiveness-pass.rs
slice_patterns: remove gates in tests
[rust.git] / src / test / ui / or-patterns / exhaustiveness-pass.rs
1 #![feature(or_patterns)]
2
3 #![allow(incomplete_features)]
4 #![deny(unreachable_patterns)]
5
6 // We wrap patterns in a tuple because top-level or-patterns are special-cased for now.
7 fn main() {
8     // Get the fatal error out of the way
9     match (0,) {
10         (0 | _,) => {}
11         //~^ ERROR or-patterns are not fully implemented yet
12     }
13
14     match (0,) {
15         (1 | 2,) => {}
16         _ => {}
17     }
18
19     match (0, 0) {
20         (1 | 2, 3 | 4) => {}
21         (1, 2) => {}
22         (3, 1) => {}
23         _ => {}
24     }
25     match (Some(0u8),) {
26         (None | Some(0 | 1),) => {}
27         (Some(2..=255),) => {}
28     }
29     match ((0,),) {
30         ((0 | 1,) | (2 | 3,),) => {},
31         ((_,),) => {},
32     }
33     match (&[0u8][..],) {
34         ([] | [0 | 1..=255] | [_, ..],) => {},
35     }
36
37     match ((0, 0),) {
38         ((0, 0) | (0, 1),) => {}
39         _ => {}
40     }
41     match ((0, 0),) {
42         ((0, 0) | (1, 0),) => {}
43         _ => {}
44     }
45 }