about summary refs log tree commit diff
path: root/src/test/ui/consts/const-eval/ub-ref-ptr.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-08-26 21:50:09 +0000
committerbors <bors@rust-lang.org>2022-08-26 21:50:09 +0000
commit2b443a8d97ff1f26c35e4bcf682bf9a89e8a66d2 (patch)
treef8fda39334d16175c69f121ad282df2f9d92e9fd /src/test/ui/consts/const-eval/ub-ref-ptr.rs
parentc07a8b4e09f356c7468b69c50cac7fc5b5000b8a (diff)
parent62b6a8b7b84ebaa375bd2b3a2f1df75b640be0ab (diff)
Auto merge of #100043 - RalfJung:scalar-always-init, r=RalfJung
interpret: remove support for uninitialized scalars

With Miri no longer supporting `-Zmiri-allow-uninit-numbers`, we no longer need to support storing uninit data in a `Scalar`. We anyway already only use this representation for types with *initialized* `Scalar` layout (and we have to, due to partial initialization), so let's get rid of the `ScalarMaybeUninit` type entirely.

I tried to stage this into meaningful commits, but the one that changes `read_immediate` to always trigger UB on uninit is the largest chunk of the PR and I don't see how it could be subdivided.

Fixes https://github.com/rust-lang/miri/issues/2187
r? `@oli-obk`
Diffstat (limited to 'src/test/ui/consts/const-eval/ub-ref-ptr.rs')
-rw-r--r--src/test/ui/consts/const-eval/ub-ref-ptr.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/test/ui/consts/const-eval/ub-ref-ptr.rs b/src/test/ui/consts/const-eval/ub-ref-ptr.rs
index d0216f74668..c62848f70db 100644
--- a/src/test/ui/consts/const-eval/ub-ref-ptr.rs
+++ b/src/test/ui/consts/const-eval/ub-ref-ptr.rs
@@ -51,12 +51,14 @@ const USIZE_AS_BOX: Box<u8> = unsafe { mem::transmute(1337usize) };
 //~^ ERROR it is undefined behavior to use this value
 
 const UNINIT_PTR: *const i32 = unsafe { MaybeUninit { uninit: () }.init };
-//~^ ERROR it is undefined behavior to use this value
+//~^ ERROR evaluation of constant value failed
+//~| uninitialized
 
 const NULL_FN_PTR: fn() = unsafe { mem::transmute(0usize) };
 //~^ ERROR it is undefined behavior to use this value
 const UNINIT_FN_PTR: fn() = unsafe { MaybeUninit { uninit: () }.init };
-//~^ ERROR it is undefined behavior to use this value
+//~^ ERROR evaluation of constant value failed
+//~| uninitialized
 const DANGLING_FN_PTR: fn() = unsafe { mem::transmute(13usize) };
 //~^ ERROR it is undefined behavior to use this value
 const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) };