File tree Expand file tree Collapse file tree 1 file changed +3
-13
lines changed
src/librustc_mir/transform Expand file tree Collapse file tree 1 file changed +3
-13
lines changed Original file line number Diff line number Diff line change @@ -1648,9 +1648,9 @@ impl<'tcx> MirPass<'tcx> for QualifyAndPromoteConstants<'tcx> {
16481648 remove_drop_and_storage_dead_on_promoted_locals ( body, promoted_temps) ;
16491649 }
16501650
1651- if let Mode :: Static = mode {
1651+ if mode == Mode :: Static && !tcx . has_attr ( def_id , sym :: thread_local ) {
16521652 // `static`s (not `static mut`s) which are not `#[thread_local]` must be `Sync`.
1653- check_non_thread_local_static_is_sync ( tcx, body, def_id , hir_id) ;
1653+ check_static_is_sync ( tcx, body, hir_id) ;
16541654 }
16551655 }
16561656}
@@ -1739,17 +1739,7 @@ fn remove_drop_and_storage_dead_on_promoted_locals(
17391739 }
17401740}
17411741
1742- fn check_non_thread_local_static_is_sync (
1743- tcx : TyCtxt < ' tcx > ,
1744- body : & mut Body < ' tcx > ,
1745- def_id : DefId ,
1746- hir_id : HirId ,
1747- ) {
1748- // `#[thread_local]` statics don't have to be `Sync`.
1749- if tcx. has_attr ( def_id, sym:: thread_local) {
1750- return ;
1751- }
1752-
1742+ fn check_static_is_sync ( tcx : TyCtxt < ' tcx > , body : & mut Body < ' tcx > , hir_id : HirId ) {
17531743 let ty = body. return_ty ( ) ;
17541744 tcx. infer_ctxt ( ) . enter ( |infcx| {
17551745 let cause = traits:: ObligationCause :: new ( body. span , hir_id, traits:: SharedStatic ) ;
You can’t perform that action at this time.
0 commit comments