about summary refs log tree commit diff
path: root/tests/ui/consts/const-eval/ub-enum.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/consts/const-eval/ub-enum.rs')
-rw-r--r--tests/ui/consts/const-eval/ub-enum.rs38
1 files changed, 19 insertions, 19 deletions
diff --git a/tests/ui/consts/const-eval/ub-enum.rs b/tests/ui/consts/const-eval/ub-enum.rs
index ac543430da9..52fc9945068 100644
--- a/tests/ui/consts/const-eval/ub-enum.rs
+++ b/tests/ui/consts/const-eval/ub-enum.rs
@@ -27,13 +27,13 @@ enum Enum {
 const GOOD_ENUM: Enum = unsafe { mem::transmute(0usize) };
 
 const BAD_ENUM: Enum = unsafe { mem::transmute(1usize) };
-//~^ ERROR is undefined behavior
+//~^ ERROR expected a valid enum tag
 
 const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) };
-//~^ ERROR evaluation of constant value failed
+//~^ ERROR unable to turn pointer into integer
 
 const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) };
-//~^ ERROR evaluation of constant value failed
+//~^ ERROR unable to turn pointer into integer
 
 // # simple enum with discriminant 2
 
@@ -45,12 +45,12 @@ enum Enum2 {
 }
 
 const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) };
-//~^ ERROR is undefined behavior
+//~^ ERROR expected a valid enum tag
 const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) };
-//~^ ERROR evaluation of constant value failed
+//~^ ERROR unable to turn pointer into integer
 // something wrapping the enum so that we test layout first, not enum
 const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) };
-//~^ ERROR evaluation of constant value failed
+//~^ ERROR unable to turn pointer into integer
 
 // Undef enum discriminant.
 #[repr(C)]
@@ -58,13 +58,12 @@ union MaybeUninit<T: Copy> {
     uninit: (),
     init: T,
 }
-const BAD_ENUM2_UNDEF : Enum2 = unsafe { MaybeUninit { uninit: () }.init };
-//~^ ERROR evaluation of constant value failed
-//~| NOTE uninitialized
+const BAD_ENUM2_UNDEF: Enum2 = unsafe { MaybeUninit { uninit: () }.init };
+//~^ ERROR uninitialized
 
 // Pointer value in an enum with a niche that is not just 0.
 const BAD_ENUM2_OPTION_PTR: Option<Enum2> = unsafe { mem::transmute(&0) };
-//~^ ERROR evaluation of constant value failed
+//~^ ERROR unable to turn pointer into integer
 
 // # valid discriminant for uninhabited variant
 
@@ -81,9 +80,9 @@ const GOOD_INHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute(0u8)
 const GOOD_INHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(2u8) }; // variant C
 
 const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute(1u8) };
-//~^ ERROR is undefined behavior
+//~^ ERROR uninhabited enum variant
 const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(3u8) };
-//~^ ERROR is undefined behavior
+//~^ ERROR uninhabited enum variant
 
 // # other
 
@@ -91,20 +90,21 @@ const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(3u8)
 // variants and tuples).
 // Need to create something which does not clash with enum layout optimizations.
 const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::transmute(!0u32) }));
-//~^ ERROR is undefined behavior
+//~^ ERROR expected a valid unicode scalar
 
 // All variants are uninhabited but also have data.
 // Use `0` as constant to make behavior endianness-independent.
 const BAD_UNINHABITED_WITH_DATA1: Result<(i32, Never), (i32, !)> = unsafe { mem::transmute(0u64) };
-//~^ ERROR evaluation of constant value failed
+//~^ ERROR uninhabited enum variant
 const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { mem::transmute(0u64) };
-//~^ ERROR evaluation of constant value failed
+//~^ ERROR uninhabited enum variant
 
 const TEST_ICE_89765: () = {
     // This is a regression test for https://github.com/rust-lang/rust/issues/89765.
-    unsafe { std::mem::discriminant(&*(&() as *const () as *const Never)); };
-    //~^ ERROR evaluation of constant value failed
+    unsafe {
+        std::mem::discriminant(&*(&() as *const () as *const Never));
+        //~^ ERROR uninhabited enum variant
+    };
 };
 
-fn main() {
-}
+fn main() {}