]> git.proxmox.com Git - rustc.git/blame - src/test/ui/pattern/usefulness/slice-pattern-const-2.rs
New upstream version 1.48.0~beta.8+dfsg1
[rustc.git] / src / test / ui / pattern / usefulness / slice-pattern-const-2.rs
CommitLineData
0731742a
XL
1#![deny(unreachable_patterns)]
2
3fn 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}