]> git.lizzy.rs Git - rust.git/blob - src/test/ui/pattern/slice-pattern-const.rs
Auto merge of #56825 - alexcrichton:demangle-mem, r=nikomatsakis
[rust.git] / src / test / ui / pattern / slice-pattern-const.rs
1 //compile-pass
2
3 fn main() {
4     let s = &[0x00; 4][..]; //Slice of any value
5     const MAGIC_TEST: &[u8] = b"TEST"; //Const slice to pattern match with
6     match s {
7         MAGIC_TEST => (),
8         [0x00, 0x00, 0x00, 0x00] => (),
9         [84, 69, 83, 84] => (), // this should warn
10         _ => (),
11     }
12     match s {
13         [0x00, 0x00, 0x00, 0x00] => (),
14         MAGIC_TEST => (),
15         [84, 69, 83, 84] => (), // this should warn
16         _ => (),
17     }
18     match s {
19         [0x00, 0x00, 0x00, 0x00] => (),
20         [84, 69, 83, 84] => (),
21         MAGIC_TEST => (), // this should warn
22         _ => (),
23     }
24 }