]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const-eval/match-test-ptr-null.rs
Merge commit 'd3a2366ee877075c59b38bd8ced55f224fc7ef51' into sync_cg_clif-2022-07-26
[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 pointers cannot be cast to integers during const eval
8             0 => 42,
9             n => n,
10         }
11     }];
12 }