@@ -8,7 +8,6 @@ use rustc_middle::mir::visit::{MutatingUseContext, NonMutatingUseContext, PlaceC
8
8
use rustc_middle:: mir:: * ;
9
9
use rustc_middle:: ty:: cast:: CastTy ;
10
10
use rustc_middle:: ty:: { self , Instance , InstanceDef , TyCtxt } ;
11
- use rustc_span:: symbol:: sym;
12
11
use rustc_span:: Span ;
13
12
use rustc_trait_selection:: traits:: error_reporting:: InferCtxtExt ;
14
13
use rustc_trait_selection:: traits:: { self , TraitEngine } ;
@@ -224,7 +223,7 @@ impl Validator<'mir, 'tcx> {
224
223
225
224
// Ensure that the end result is `Sync` in a non-thread local `static`.
226
225
let should_check_for_sync =
227
- const_kind == Some ( ConstKind :: Static ) && !tcx. has_attr ( def_id, sym :: thread_local ) ;
226
+ const_kind == Some ( ConstKind :: Static ) && !tcx. is_thread_local_static ( def_id) ;
228
227
229
228
if should_check_for_sync {
230
229
let hir_id = tcx. hir ( ) . as_local_hir_id ( def_id. expect_local ( ) ) ;
@@ -267,8 +266,7 @@ impl Validator<'mir, 'tcx> {
267
266
}
268
267
269
268
fn check_static ( & mut self , def_id : DefId , span : Span ) {
270
- let is_thread_local = self . tcx . has_attr ( def_id, sym:: thread_local) ;
271
- if is_thread_local {
269
+ if self . tcx . is_thread_local_static ( def_id) {
272
270
self . check_op_spanned ( ops:: ThreadLocalAccess , span)
273
271
} else {
274
272
self . check_op_spanned ( ops:: StaticAccess , span)
0 commit comments