File tree Expand file tree Collapse file tree 6 files changed +12
-11
lines changed
compiler/rustc_const_eval Expand file tree Collapse file tree 6 files changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ const_eval_expected_inbounds_pointer =
9393 }
9494
9595const_eval_extern_static =
96- cannot access extern static ( { $did } )
96+ cannot access extern static ` { $did } `
9797const_eval_extern_type_field = `extern type` field does not have a known offset
9898
9999const_eval_fn_ptr_call =
@@ -381,7 +381,7 @@ const_eval_thread_local_access =
381381 thread-local statics cannot be accessed at compile-time
382382
383383const_eval_thread_local_static =
384- cannot access thread local static ( { $did } )
384+ cannot access thread local static ` { $did } `
385385const_eval_too_generic =
386386 encountered overly generic constant
387387const_eval_too_many_caller_args =
Original file line number Diff line number Diff line change @@ -898,6 +898,7 @@ impl ReportErrorExt for UnsupportedOpInfo {
898898 UnsupportedOpInfo :: ExternStatic ( _) => const_eval_extern_static,
899899 }
900900 }
901+
901902 fn add_args < G : EmissionGuarantee > ( self , diag : & mut Diag < ' _ , G > ) {
902903 use UnsupportedOpInfo :: * ;
903904
@@ -917,9 +918,9 @@ impl ReportErrorExt for UnsupportedOpInfo {
917918 OverwritePartialPointer ( ptr) | ReadPartialPointer ( ptr) => {
918919 diag. arg ( "ptr" , ptr) ;
919920 }
920- ThreadLocalStatic ( did) | ExternStatic ( did) => {
921- diag. arg ( "did" , format ! ( "{ did:?}" ) ) ;
922- }
921+ ThreadLocalStatic ( did) | ExternStatic ( did) => rustc_middle :: ty :: tls :: with ( |tcx| {
922+ diag. arg ( "did" , tcx . def_path_str ( did) ) ;
923+ } ) ,
923924 }
924925 }
925926}
Original file line number Diff line number Diff line change @@ -2,13 +2,13 @@ error[E0080]: could not evaluate static initializer
22 --> $DIR/extern-static.rs:11:25
33 |
44LL | unsafe { let _val = DATA; }
5- | ^^^^ cannot access extern static (DefId(0:4 ~ extern_static[c41e]::{extern#0}:: DATA))
5+ | ^^^^ cannot access extern static ` DATA`
66
77error[E0080]: could not evaluate static initializer
88 --> $DIR/extern-static.rs:16:14
99 |
1010LL | unsafe { DATA = 0; }
11- | ^^^^^^^^ cannot access extern static (DefId(0:4 ~ extern_static[c41e]::{extern#0}:: DATA))
11+ | ^^^^^^^^ cannot access extern static ` DATA`
1212
1313error: aborting due to 2 previous errors
1414
Original file line number Diff line number Diff line change @@ -2,13 +2,13 @@ error[E0080]: could not evaluate static initializer
22 --> $DIR/tls.rs:11:25
33 |
44LL | unsafe { let _val = A; }
5- | ^ cannot access thread local static (DefId(0:4 ~ tls[ca29]::A))
5+ | ^ cannot access thread local static `A`
66
77error[E0080]: could not evaluate static initializer
88 --> $DIR/tls.rs:20:26
99 |
1010LL | unsafe { let _val = &A; }
11- | ^ cannot access thread local static (DefId(0:4 ~ tls[ca29]::A))
11+ | ^ cannot access thread local static `A`
1212
1313warning: skipping const checks
1414 |
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ error[E0080]: could not evaluate static initializer
22 --> $DIR/issue-28324.rs:5:23
33 |
44LL | pub static BAZ: u32 = *&error_message_count;
5- | ^^^^^^^^^^^^^^^^^^^^^ cannot access extern static (DefId(0:4 ~ issue_28324[8ec4]::{extern#0}:: error_message_count))
5+ | ^^^^^^^^^^^^^^^^^^^^^ cannot access extern static ` error_message_count`
66
77error[E0133]: use of extern static is unsafe and requires unsafe function or block
88 --> $DIR/issue-28324.rs:5:25
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ error[E0080]: could not evaluate static initializer
22 --> $DIR/issue-14227.rs:4:21
33 |
44LL | static CRASH: u32 = symbol;
5- | ^^^^^^ cannot access extern static (DefId(0:4 ~ issue_14227[1133]::{extern#0}:: symbol))
5+ | ^^^^^^ cannot access extern static ` symbol`
66
77error[E0133]: use of extern static is unsafe and requires unsafe function or block
88 --> $DIR/issue-14227.rs:4:21
You can’t perform that action at this time.
0 commit comments