about summary refs log tree commit diff
path: root/tests/ui/consts/const-eval/raw-pointer-ub.rs
diff options
context:
space:
mode:
authorOli Scherer <github333195615777966@oli-obk.de>2025-05-28 10:29:08 +0000
committerOli Scherer <github333195615777966@oli-obk.de>2025-06-02 15:37:15 +0000
commitb331b8b96d86a6433df957a3cc49ed51f3656135 (patch)
tree72e20ae9fa73a475719589593a790156181e4e24 /tests/ui/consts/const-eval/raw-pointer-ub.rs
parente6152cdf5b31bd844a4cc1049433859d54863602 (diff)
downloadrust-b331b8b96d86a6433df957a3cc49ed51f3656135.tar.gz
rust-b331b8b96d86a6433df957a3cc49ed51f3656135.zip
Use the informative error as the main const eval error message
Diffstat (limited to 'tests/ui/consts/const-eval/raw-pointer-ub.rs')
-rw-r--r--tests/ui/consts/const-eval/raw-pointer-ub.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/ui/consts/const-eval/raw-pointer-ub.rs b/tests/ui/consts/const-eval/raw-pointer-ub.rs
index 1e76104d515..c8d1e36e88b 100644
--- a/tests/ui/consts/const-eval/raw-pointer-ub.rs
+++ b/tests/ui/consts/const-eval/raw-pointer-ub.rs
@@ -1,15 +1,15 @@
 const MISALIGNED_LOAD: () = unsafe {
     let mem = [0u32; 8];
     let ptr = mem.as_ptr().byte_add(1);
-    let _val = *ptr; //~ERROR: evaluation of constant value failed
-    //~^NOTE: based on pointer with alignment 1, but alignment 4 is required
+    let _val = *ptr; //~NOTE: evaluation of constant value failed
+    //~^ERROR: based on pointer with alignment 1, but alignment 4 is required
 };
 
 const MISALIGNED_STORE: () = unsafe {
     let mut mem = [0u32; 8];
     let ptr = mem.as_mut_ptr().byte_add(1);
-    *ptr = 0; //~ERROR: evaluation of constant value failed
-    //~^NOTE: based on pointer with alignment 1, but alignment 4 is required
+    *ptr = 0; //~NOTE: evaluation of constant value failed
+    //~^ERROR: based on pointer with alignment 1, but alignment 4 is required
 };
 
 const MISALIGNED_COPY: () = unsafe {
@@ -17,9 +17,9 @@ const MISALIGNED_COPY: () = unsafe {
     let y = x.as_ptr().cast::<u32>();
     let mut z = 123;
     y.copy_to_nonoverlapping(&mut z, 1);
-    //~^ ERROR evaluation of constant value failed
+    //~^ NOTE evaluation of constant value failed
     //~| NOTE inside `std::ptr::copy_nonoverlapping::<u32>`
-    //~| NOTE accessing memory with alignment 1, but alignment 4 is required
+    //~| ERROR accessing memory with alignment 1, but alignment 4 is required
     // The actual error points into the implementation of `copy_to_nonoverlapping`.
 };
 
@@ -30,15 +30,15 @@ const MISALIGNED_FIELD: () = unsafe {
     let mem = [0f32; 8];
     let ptr = mem.as_ptr().cast::<Aligned>();
     // Accessing an f32 field but we still require the alignment of the pointer type.
-    let _val = (*ptr).0; //~ERROR: evaluation of constant value failed
-    //~^NOTE: based on pointer with alignment 4, but alignment 16 is required
+    let _val = (*ptr).0; //~NOTE: evaluation of constant value failed
+    //~^ERROR: based on pointer with alignment 4, but alignment 16 is required
 };
 
 const OOB: () = unsafe {
     let mem = [0u32; 1];
     let ptr = mem.as_ptr().cast::<u64>();
-    let _val = *ptr; //~ERROR: evaluation of constant value failed
-    //~^NOTE: is only 4 bytes from the end of the allocation
+    let _val = *ptr; //~NOTE: evaluation of constant value failed
+    //~^ERROR: is only 4 bytes from the end of the allocation
 };
 
 fn main() {}