diff options
| author | Matthias Krüger <476013+matthiaskrgr@users.noreply.github.com> | 2025-03-20 22:34:06 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-20 22:34:06 +0100 |
| commit | 73ed8b3ace71b8d5deef993e78b936d352d29348 (patch) | |
| tree | a14cb8541ec51418db352663d8a3a4c0dbba19e1 /compiler | |
| parent | 7df0170fc4c285e0876fd398ceaff05f84164ce3 (diff) | |
| parent | e6004ccb50880f9667015eea2f3d90f30517abd1 (diff) | |
| download | rust-73ed8b3ace71b8d5deef993e78b936d352d29348.tar.gz rust-73ed8b3ace71b8d5deef993e78b936d352d29348.zip | |
Rollup merge of #138732 - compiler-errors:did, r=jieyouxu
Use `def_path_str` for def id arg in `UnsupportedOpInfo` We could alternatively just omit the def path from the label, but I think it's fine to keep around Fixes #138730
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_const_eval/messages.ftl | 4 | ||||
| -rw-r--r-- | compiler/rustc_const_eval/src/errors.rs | 7 |
2 files changed, 6 insertions, 5 deletions
diff --git a/compiler/rustc_const_eval/messages.ftl b/compiler/rustc_const_eval/messages.ftl index ccf9b240d40..dd481e04abb 100644 --- a/compiler/rustc_const_eval/messages.ftl +++ b/compiler/rustc_const_eval/messages.ftl @@ -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 = diff --git a/compiler/rustc_const_eval/src/errors.rs b/compiler/rustc_const_eval/src/errors.rs index b020eeccf71..e2675e2f4c9 100644 --- a/compiler/rustc_const_eval/src/errors.rs +++ b/compiler/rustc_const_eval/src/errors.rs @@ -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)); + }), } } } |
