]> git.lizzy.rs Git - rust.git/blob - src/test/ui/or-patterns/exhaustiveness-pass.rs
Auto merge of #83245 - the8472:generalize-slice-fill, r=m-ou-se
[rust.git] / src / test / ui / or-patterns / exhaustiveness-pass.rs
1 #![deny(unreachable_patterns)]
2
3 // check-pass
4
5 // We wrap patterns in a tuple because top-level or-patterns were special-cased.
6 fn main() {
7     match (0,) {
8         (1 | 2,) => {}
9         _ => {}
10     }
11
12     match (0, 0) {
13         (1 | 2, 3 | 4) => {}
14         (1, 2) => {}
15         (3, 1) => {}
16         _ => {}
17     }
18     match (Some(0u8),) {
19         (None | Some(0 | 1),) => {}
20         (Some(2..=255),) => {}
21     }
22     match ((0,),) {
23         ((0 | 1,) | (2 | 3,),) => {}
24         ((_,),) => {}
25     }
26     match (&[0u8][..],) {
27         ([] | [0 | 1..=255] | [_, ..],) => {}
28     }
29
30     match ((0, 0),) {
31         ((0, 0) | (0, 1),) => {}
32         _ => {}
33     }
34     match ((0, 0),) {
35         ((0, 0) | (1, 0),) => {}
36         _ => {}
37     }
38 }