diff options
Diffstat (limited to 'src/test/ui/consts/const-eval/const_raw_ptr_ops2.rs')
-rw-r--r-- | src/test/ui/consts/const-eval/const_raw_ptr_ops2.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/test/ui/consts/const-eval/const_raw_ptr_ops2.rs b/src/test/ui/consts/const-eval/const_raw_ptr_ops2.rs new file mode 100644 index 000000000..ec5508a1e --- /dev/null +++ b/src/test/ui/consts/const-eval/const_raw_ptr_ops2.rs @@ -0,0 +1,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 +//~| is a dangling pointer +const Z3: i32 = unsafe { *(44 as *const i32) }; //~ ERROR evaluation of constant value failed +//~| is a dangling pointer |