From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/consts/const-eval/const_raw_ptr_ops2.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tests/ui/consts/const-eval/const_raw_ptr_ops2.rs (limited to 'tests/ui/consts/const-eval/const_raw_ptr_ops2.rs') diff --git a/tests/ui/consts/const-eval/const_raw_ptr_ops2.rs b/tests/ui/consts/const-eval/const_raw_ptr_ops2.rs new file mode 100644 index 000000000..ec5508a1e --- /dev/null +++ b/tests/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 -- cgit v1.2.3