1
Fork 0

Use def_path_str for def id arg in UnsupportedOpInfo

This commit is contained in:
Michael Goulet 2025-03-20 03:21:58 +00:00
parent 2947be7af8
commit e6004ccb50
6 changed files with 12 additions and 11 deletions

View file

@ -93,7 +93,7 @@ const_eval_expected_inbounds_pointer =
}
const_eval_extern_static =
cannot access extern static ({$did})
cannot access extern static `{$did}`
const_eval_extern_type_field = `extern type` field does not have a known offset
const_eval_fn_ptr_call =
@ -381,7 +381,7 @@ const_eval_thread_local_access =
thread-local statics cannot be accessed at compile-time
const_eval_thread_local_static =
cannot access thread local static ({$did})
cannot access thread local static `{$did}`
const_eval_too_generic =
encountered overly generic constant
const_eval_too_many_caller_args =

View file

@ -898,6 +898,7 @@ impl ReportErrorExt for UnsupportedOpInfo {
UnsupportedOpInfo::ExternStatic(_) => const_eval_extern_static,
}
}
fn add_args<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
use UnsupportedOpInfo::*;
@ -917,9 +918,9 @@ impl ReportErrorExt for UnsupportedOpInfo {
OverwritePartialPointer(ptr) | ReadPartialPointer(ptr) => {
diag.arg("ptr", ptr);
}
ThreadLocalStatic(did) | ExternStatic(did) => {
diag.arg("did", format!("{did:?}"));
}
ThreadLocalStatic(did) | ExternStatic(did) => rustc_middle::ty::tls::with(|tcx| {
diag.arg("did", tcx.def_path_str(did));
}),
}
}
}