about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src/const_eval
diff options
context:
space:
mode:
authorDeadbeef <ent3rm4n@gmail.com>2025-07-10 17:54:55 +0800
committerDeadbeef <ent3rm4n@gmail.com>2025-07-16 00:32:12 +0800
commit44b38ca45edc4bd826f4ef5e3fb2221cbd1649cd (patch)
tree4c8b2465c1f9f4838de0808bac24e7f196a79077 /compiler/rustc_const_eval/src/const_eval
parent3f2dc2bd1a2e0120b868911497ddbd8e43f3a9fa (diff)
format pointer later instead of eagerly converting to string
Diffstat (limited to 'compiler/rustc_const_eval/src/const_eval')
-rw-r--r--compiler/rustc_const_eval/src/const_eval/error.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_const_eval/src/const_eval/error.rs b/compiler/rustc_const_eval/src/const_eval/error.rs
index 5b07b7c13c1..3e880d02001 100644
--- a/compiler/rustc_const_eval/src/const_eval/error.rs
+++ b/compiler/rustc_const_eval/src/const_eval/error.rs
@@ -11,8 +11,8 @@ use rustc_span::{Span, Symbol};
 use super::CompileTimeMachine;
 use crate::errors::{self, FrameNote, ReportErrorExt};
 use crate::interpret::{
-    ErrorHandled, Frame, InterpErrorInfo, InterpErrorKind, MachineStopType, err_inval,
-    err_machine_stop,
+    CtfeProvenance, ErrorHandled, Frame, InterpErrorInfo, InterpErrorKind, MachineStopType,
+    Pointer, err_inval, err_machine_stop,
 };
 
 /// The CTFE machine has some custom error kinds.
@@ -32,12 +32,12 @@ pub enum ConstEvalErrKind {
     /// Called `const_make_global` twice.
     ConstMakeGlobalPtrAlreadyMadeGlobal(AllocId),
     /// Called `const_make_global` on a non-heap pointer.
-    ConstMakeGlobalPtrIsNonHeap(String),
+    ConstMakeGlobalPtrIsNonHeap(Pointer<Option<CtfeProvenance>>),
     /// Called `const_make_global` on a dangling pointer.
-    ConstMakeGlobalWithDanglingPtr(String),
+    ConstMakeGlobalWithDanglingPtr(Pointer<Option<CtfeProvenance>>),
     /// Called `const_make_global` on a pointer that does not start at the
     /// beginning of an object.
-    ConstMakeGlobalWithOffset(String),
+    ConstMakeGlobalWithOffset(Pointer<Option<CtfeProvenance>>),
 }
 
 impl MachineStopType for ConstEvalErrKind {
@@ -74,7 +74,7 @@ impl MachineStopType for ConstEvalErrKind {
             ConstMakeGlobalPtrIsNonHeap(ptr)
             | ConstMakeGlobalWithOffset(ptr)
             | ConstMakeGlobalWithDanglingPtr(ptr) => {
-                adder("ptr".into(), ptr.into_diag_arg(&mut None));
+                adder("ptr".into(), format!("{ptr:?}").into_diag_arg(&mut None));
             }
             ConstMakeGlobalPtrAlreadyMadeGlobal(alloc) => {
                 adder("alloc".into(), alloc.into_diag_arg(&mut None));