rust/tests/ui/consts/const-eval/const_raw_ptr_ops2.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

11 lines
344 B
Rust
Raw Normal View History

fn main() {}
// fine
const Z: i32 = unsafe { *(&1 as *const i32) };
// bad, will thus error in miri
2021-07-12 17:21:35 -05:00
const Z2: i32 = unsafe { *(42 as *const i32) }; //~ ERROR evaluation of constant value failed
2022-07-03 14:46:22 -05:00
//~| is a dangling pointer
2021-07-12 17:21:35 -05:00
const Z3: i32 = unsafe { *(44 as *const i32) }; //~ ERROR evaluation of constant value failed
2022-07-03 14:46:22 -05:00
//~| is a dangling pointer