]> git.proxmox.com Git - rustc.git/blame - src/test/ui/consts/references.rs
New upstream version 1.67.1+dfsg1
[rustc.git] / src / test / ui / consts / references.rs
CommitLineData
b7449926
XL
1// run-pass
2
0531ce1d
XL
3const FOO: &[u8] = b"foo";
4const BAR: &[u8] = &[1, 2, 3];
223e47cc 5
0531ce1d 6const BOO: &i32 = &42;
32a655c1 7
970d7e83 8fn main() {
0531ce1d
XL
9 match &[1u8, 2, 3] as &[u8] {
10 FOO => panic!("a"),
11 BAR => println!("b"),
12 _ => panic!("c"),
13 }
14
15 match b"foo" as &[u8] {
16 FOO => println!("a"),
17 BAR => panic!("b"),
18 _ => panic!("c"),
19 }
20
0731742a 21 #[allow(unreachable_patterns)]
0531ce1d
XL
22 match &43 {
23 &42 => panic!(),
24 BOO => panic!(),
25 _ => println!("d"),
9e0c209e 26 }
223e47cc 27}