]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const-eval/const_raw_ptr_ops2.rs
Rollup merge of #104076 - ozkanonur:fix-ci-rustc-sysroot, r=jyn514
[rust.git] / src / test / ui / consts / const-eval / const_raw_ptr_ops2.rs
1 fn main() {}
2
3 // fine
4 const Z: i32 = unsafe { *(&1 as *const i32) };
5
6 // bad, will thus error in miri
7 const Z2: i32 = unsafe { *(42 as *const i32) }; //~ ERROR evaluation of constant value failed
8 //~| is a dangling pointer
9 const Z3: i32 = unsafe { *(44 as *const i32) }; //~ ERROR evaluation of constant value failed
10 //~| is a dangling pointer