]>
Commit | Line | Data |
---|---|---|
0731742a XL |
1 | #![deny(unreachable_patterns)] |
2 | ||
3 | fn main() { | |
4 | let s = &[0x00; 4][..]; //Slice of any value | |
5 | const MAGIC_TEST: &[u32] = &[4, 5, 6, 7]; //Const slice to pattern match with | |
6 | match s { | |
7 | MAGIC_TEST => (), | |
8 | [0x00, 0x00, 0x00, 0x00] => (), | |
1b1a35ee | 9 | [4, 5, 6, 7] => (), //~ ERROR unreachable pattern |
0731742a XL |
10 | _ => (), |
11 | } | |
12 | match s { | |
13 | [0x00, 0x00, 0x00, 0x00] => (), | |
14 | MAGIC_TEST => (), | |
1b1a35ee | 15 | [4, 5, 6, 7] => (), //~ ERROR unreachable pattern |
0731742a XL |
16 | _ => (), |
17 | } | |
18 | match s { | |
19 | [0x00, 0x00, 0x00, 0x00] => (), | |
20 | [4, 5, 6, 7] => (), | |
1b1a35ee | 21 | MAGIC_TEST => (), //~ ERROR unreachable pattern |
0731742a XL |
22 | _ => (), |
23 | } | |
24 | const FOO: [u32; 1] = [4]; | |
25 | match [99] { | |
26 | [0x00] => (), | |
27 | [4] => (), | |
28 | FOO => (), //~ ERROR unreachable pattern | |
29 | _ => (), | |
30 | } | |
31 | } |