Use def_path_str for def id arg in UnsupportedOpInfo
This commit is contained in:
parent
2947be7af8
commit
e6004ccb50
6 changed files with 12 additions and 11 deletions
|
@ -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 =
|
||||
|
|
|
@ -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));
|
||||
}),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,13 +2,13 @@ error[E0080]: could not evaluate static initializer
|
|||
--> $DIR/extern-static.rs:11:25
|
||||
|
|
||||
LL | unsafe { let _val = DATA; }
|
||||
| ^^^^ cannot access extern static (DefId(0:4 ~ extern_static[c41e]::{extern#0}::DATA))
|
||||
| ^^^^ cannot access extern static `DATA`
|
||||
|
||||
error[E0080]: could not evaluate static initializer
|
||||
--> $DIR/extern-static.rs:16:14
|
||||
|
|
||||
LL | unsafe { DATA = 0; }
|
||||
| ^^^^^^^^ cannot access extern static (DefId(0:4 ~ extern_static[c41e]::{extern#0}::DATA))
|
||||
| ^^^^^^^^ cannot access extern static `DATA`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
@ -2,13 +2,13 @@ error[E0080]: could not evaluate static initializer
|
|||
--> $DIR/tls.rs:11:25
|
||||
|
|
||||
LL | unsafe { let _val = A; }
|
||||
| ^ cannot access thread local static (DefId(0:4 ~ tls[ca29]::A))
|
||||
| ^ cannot access thread local static `A`
|
||||
|
||||
error[E0080]: could not evaluate static initializer
|
||||
--> $DIR/tls.rs:20:26
|
||||
|
|
||||
LL | unsafe { let _val = &A; }
|
||||
| ^ cannot access thread local static (DefId(0:4 ~ tls[ca29]::A))
|
||||
| ^ cannot access thread local static `A`
|
||||
|
||||
warning: skipping const checks
|
||||
|
|
||||
|
|
2
tests/ui/extern/issue-28324.stderr
vendored
2
tests/ui/extern/issue-28324.stderr
vendored
|
@ -2,7 +2,7 @@ error[E0080]: could not evaluate static initializer
|
|||
--> $DIR/issue-28324.rs:5:23
|
||||
|
|
||||
LL | pub static BAZ: u32 = *&error_message_count;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ cannot access extern static (DefId(0:4 ~ issue_28324[8ec4]::{extern#0}::error_message_count))
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ cannot access extern static `error_message_count`
|
||||
|
||||
error[E0133]: use of extern static is unsafe and requires unsafe function or block
|
||||
--> $DIR/issue-28324.rs:5:25
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0080]: could not evaluate static initializer
|
|||
--> $DIR/issue-14227.rs:4:21
|
||||
|
|
||||
LL | static CRASH: u32 = symbol;
|
||||
| ^^^^^^ cannot access extern static (DefId(0:4 ~ issue_14227[1133]::{extern#0}::symbol))
|
||||
| ^^^^^^ cannot access extern static `symbol`
|
||||
|
||||
error[E0133]: use of extern static is unsafe and requires unsafe function or block
|
||||
--> $DIR/issue-14227.rs:4:21
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue