about summary refs log tree commit diff
path: root/tests/ui/consts/missing_span_in_backtrace.rs
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2025-07-17 20:00:19 +0200
committerRalf Jung <post@ralfj.de>2025-07-30 08:13:58 +0200
commitba5b6b9ec472dc32bdaa8b18c22d30bd6abf7ebc (patch)
tree212b535aaa7414d1336c8817dc8db1a0adbd670c /tests/ui/consts/missing_span_in_backtrace.rs
parent051d0e8a957c98f87ddaf6295c3a3ecd88742ff9 (diff)
downloadrust-ba5b6b9ec472dc32bdaa8b18c22d30bd6abf7ebc.tar.gz
rust-ba5b6b9ec472dc32bdaa8b18c22d30bd6abf7ebc.zip
const-eval: full support for pointer fragments
Diffstat (limited to 'tests/ui/consts/missing_span_in_backtrace.rs')
-rw-r--r--tests/ui/consts/missing_span_in_backtrace.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/ui/consts/missing_span_in_backtrace.rs b/tests/ui/consts/missing_span_in_backtrace.rs
index 4f3f9aa6ada..09a11c75fd7 100644
--- a/tests/ui/consts/missing_span_in_backtrace.rs
+++ b/tests/ui/consts/missing_span_in_backtrace.rs
@@ -1,3 +1,4 @@
+//! Check what happens when the error occurs inside a std function that we can't print the span of.
 //@ ignore-backends: gcc
 //@ compile-flags: -Z ui-testing=no
 
@@ -7,15 +8,15 @@ use std::{
 };
 
 const X: () = {
-    let mut ptr1 = &1;
-    let mut ptr2 = &2;
+    let mut x1 = 1;
+    let mut x2 = 2;
 
     // Swap them, bytewise.
     unsafe {
-        ptr::swap_nonoverlapping( //~ ERROR unable to copy parts of a pointer
-            &mut ptr1 as *mut _ as *mut MaybeUninit<u8>,
-            &mut ptr2 as *mut _ as *mut MaybeUninit<u8>,
-            mem::size_of::<&i32>(),
+        ptr::swap_nonoverlapping( //~ ERROR beyond the end of the allocation
+            &mut x1 as *mut _ as *mut MaybeUninit<u8>,
+            &mut x2 as *mut _ as *mut MaybeUninit<u8>,
+            10,
         );
     }
 };