]> git.proxmox.com Git - rustc.git/blob - src/test/ui/pattern/usefulness/slice-pattern-const-2.rs
New upstream version 1.41.1+dfsg1
[rustc.git] / src / test / ui / pattern / usefulness / slice-pattern-const-2.rs
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] => (),
9 [4, 5, 6, 7] => (), // FIXME(oli-obk): this should warn, but currently does not
10 _ => (),
11 }
12 match s {
13 [0x00, 0x00, 0x00, 0x00] => (),
14 MAGIC_TEST => (),
15 [4, 5, 6, 7] => (), // FIXME(oli-obk): this should warn, but currently does not
16 _ => (),
17 }
18 match s {
19 [0x00, 0x00, 0x00, 0x00] => (),
20 [4, 5, 6, 7] => (),
21 MAGIC_TEST => (), // FIXME(oli-obk): this should warn, but currently does not
22 _ => (),
23 }
24 const FOO: [u32; 1] = [4];
25 match [99] {
26 [0x00] => (),
27 [4] => (),
28 FOO => (), //~ ERROR unreachable pattern
29 _ => (),
30 }
31 }