]> git.proxmox.com Git - rustc.git/blob - src/test/ui/pattern/slice-pattern-const-3.rs
New upstream version 1.40.0+dfsg1
[rustc.git] / src / test / ui / pattern / slice-pattern-const-3.rs
1 #![deny(unreachable_patterns)]
2
3 fn main() {
4 let s = &["0x00"; 4][..]; //Slice of any value
5 const MAGIC_TEST: &[&str] = &["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: [&str; 1] = ["boo"];
25 match ["baa"] {
26 ["0x00"] => (),
27 ["boo"] => (),
28 FOO => (), //~ ERROR unreachable pattern
29 _ => (),
30 }
31 }