]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const-eval/match-test-ptr-null.rs
Merge commit 'b20d4c155d2fe3a8391f86dcf9a8c49e17188703' into clippyup
[rust.git] / src / test / ui / consts / const-eval / match-test-ptr-null.rs
1 fn main() {
2     // Make sure match uses the usual pointer comparison code path -- i.e., it should complain
3     // that pointer comparison is disallowed, not that parts of a pointer are accessed as raw
4     // bytes.
5     let _: [u8; 0] = [4; {
6         match &1 as *const i32 as usize {
7             //~^ ERROR casting pointers to integers in constants
8             //~| ERROR evaluation of constant value failed
9             0 => 42,
10             n => n,
11         }
12     }];
13 }