1
Fork 0

Rollup merge of #120883 - RalfJung:extern-static-err, r=oli-obk

interpret: rename ReadExternStatic → ExternStatic

This error shows up for reads and writes, so `ReadExternStatic` is misleading.
This commit is contained in:
Matthias Krüger 2024-02-11 01:37:56 +01:00 committed by GitHub
commit 09bbcd6667
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 49 additions and 8 deletions

View file

@ -799,7 +799,7 @@ impl ReportErrorExt for UnsupportedOpInfo {
UnsupportedOpInfo::ReadPartialPointer(_) => const_eval_partial_pointer_copy,
UnsupportedOpInfo::ReadPointerAsInt(_) => const_eval_read_pointer_as_int,
UnsupportedOpInfo::ThreadLocalStatic(_) => const_eval_thread_local_static,
UnsupportedOpInfo::ReadExternStatic(_) => const_eval_read_extern_static,
UnsupportedOpInfo::ExternStatic(_) => const_eval_extern_static,
}
}
fn add_args<G: EmissionGuarantee>(self, _: &DiagCtxt, builder: &mut DiagnosticBuilder<'_, G>) {
@ -818,7 +818,7 @@ impl ReportErrorExt for UnsupportedOpInfo {
OverwritePartialPointer(ptr) | ReadPartialPointer(ptr) => {
builder.arg("ptr", ptr);
}
ThreadLocalStatic(did) | ReadExternStatic(did) => {
ThreadLocalStatic(did) | ExternStatic(did) => {
builder.arg("did", format!("{did:?}"));
}
}

View file

@ -557,7 +557,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
if self.tcx.is_foreign_item(def_id) {
// This is unreachable in Miri, but can happen in CTFE where we actually *do* support
// referencing arbitrary (declared) extern statics.
throw_unsup!(ReadExternStatic(def_id));
throw_unsup!(ExternStatic(def_id));
}
// We don't give a span -- statics don't need that, they cannot be generic or associated.