]> git.proxmox.com Git - rustc.git/blob - src/test/ui/consts/const-eval/const_raw_ptr_ops2.rs
New upstream version 1.55.0+dfsg1
[rustc.git] / src / test / ui / consts / const-eval / const_raw_ptr_ops2.rs
1 #![feature(const_raw_ptr_deref)]
2
3 fn main() {}
4
5 // fine
6 const Z: i32 = unsafe { *(&1 as *const i32) };
7
8 // bad, will thus error in miri
9 const Z2: i32 = unsafe { *(42 as *const i32) }; //~ ERROR evaluation of constant value failed
10 //~| is not a valid pointer
11 const Z3: i32 = unsafe { *(44 as *const i32) }; //~ ERROR evaluation of constant value failed
12 //~| is not a valid pointer