summary refs log tree commit diff
path: root/tests/ui/consts/const-eval/const_raw_ptr_ops2.rs
blob: 0e88aa80c7977c9682a7d2f193a445324e7b095e (plain)
1
2
3
4
5
6
7
8
9
10
fn main() {}

// fine
const Z: i32 = unsafe { *(&1 as *const i32) };

// bad, will thus error in miri
const Z2: i32 = unsafe { *(42 as *const i32) }; //~ ERROR evaluation of constant value failed
//~| NOTE dangling pointer
const Z3: i32 = unsafe { *(44 as *const i32) }; //~ ERROR evaluation of constant value failed
//~| NOTE dangling pointer