]> git.lizzy.rs Git - rust.git/blob - tests/ui/consts/references.rs
Rollup merge of #106699 - eholk:await-chains-drop-tracking, r=wesleywiser
[rust.git] / tests / ui / consts / references.rs
1 // run-pass
2
3 const FOO: &[u8] = b"foo";
4 const BAR: &[u8] = &[1, 2, 3];
5
6 const BOO: &i32 = &42;
7
8 fn main() {
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
21     #[allow(unreachable_patterns)]
22     match &43 {
23         &42 => panic!(),
24         BOO => panic!(),
25         _ => println!("d"),
26     }
27 }