File tree 1 file changed +3
-13
lines changed
src/librustc_mir/transform
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> {
1648
1648
remove_drop_and_storage_dead_on_promoted_locals ( body, promoted_temps) ;
1649
1649
}
1650
1650
1651
- if let Mode :: Static = mode {
1651
+ if mode == Mode :: Static && !tcx . has_attr ( def_id , sym :: thread_local ) {
1652
1652
// `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) ;
1654
1654
}
1655
1655
}
1656
1656
}
@@ -1739,17 +1739,7 @@ fn remove_drop_and_storage_dead_on_promoted_locals(
1739
1739
}
1740
1740
}
1741
1741
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 ) {
1753
1743
let ty = body. return_ty ( ) ;
1754
1744
tcx. infer_ctxt ( ) . enter ( |infcx| {
1755
1745
let cause = traits:: ObligationCause :: new ( body. span , hir_id, traits:: SharedStatic ) ;
You can’t perform that action at this time.
0 commit comments