]>
Commit | Line | Data |
---|---|---|
b7449926 | 1 | // run-pass |
c34b1796 AL |
2 | |
3 | const FOO: isize = 10; | |
4 | const BAR: isize = 3; | |
dfeec247 XL |
5 | const ZST: &() = unsafe { std::mem::transmute(1usize) }; |
6 | const ZST_ARR: &[u8; 0] = unsafe { std::mem::transmute(1usize) }; | |
223e47cc | 7 | |
9cc50fc6 SL |
8 | const fn foo() -> isize { 4 } |
9 | const BOO: isize = foo(); | |
10 | ||
223e47cc | 11 | pub fn main() { |
c34b1796 | 12 | let x: isize = 3; |
223e47cc | 13 | let y = match x { |
85aaf69f SL |
14 | FOO => 1, |
15 | BAR => 2, | |
9cc50fc6 | 16 | BOO => 4, |
85aaf69f | 17 | _ => 3 |
223e47cc | 18 | }; |
970d7e83 | 19 | assert_eq!(y, 2); |
dfeec247 XL |
20 | let z = match &() { |
21 | ZST => 9, | |
22 | // FIXME: this should not be required | |
23 | _ => 42, | |
24 | }; | |
25 | assert_eq!(z, 9); | |
26 | let z = match b"" { | |
27 | ZST_ARR => 10, | |
28 | }; | |
29 | assert_eq!(z, 10); | |
223e47cc | 30 | } |