@@ -12,10 +12,11 @@ use crate::constrained_generic_params as cgp;
1212use rustc:: ty:: query:: Providers ;
1313use rustc:: ty:: { self , TyCtxt , TypeFoldable } ;
1414use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
15+ use rustc_data_structures:: sync:: par_for_each;
1516use rustc_errors:: struct_span_err;
1617use rustc_hir as hir;
1718use rustc_hir:: def_id:: DefId ;
18- use rustc_hir:: itemlikevisit:: ItemLikeVisitor ;
19+ use rustc_hir:: itemlikevisit:: ParItemLikeVisitor ;
1920use std:: collections:: hash_map:: Entry :: { Occupied , Vacant } ;
2021
2122use rustc_span:: Span ;
@@ -56,13 +57,13 @@ pub fn impl_wf_check(tcx: TyCtxt<'_>) {
5657 // We will tag this as part of the WF check -- logically, it is,
5758 // but it's one that we must perform earlier than the rest of
5859 // WfCheck.
59- for & module in tcx. hir ( ) . krate ( ) . modules . keys ( ) {
60+ par_for_each ( & tcx. hir ( ) . krate ( ) . modules , | ( & module , _ ) | {
6061 tcx. ensure ( ) . check_mod_impl_wf ( tcx. hir ( ) . local_def_id ( module) ) ;
61- }
62+ } ) ;
6263}
6364
6465fn check_mod_impl_wf ( tcx : TyCtxt < ' _ > , module_def_id : DefId ) {
65- tcx. hir ( ) . visit_item_likes_in_module ( module_def_id, & mut ImplWfCheck { tcx } ) ;
66+ tcx. hir ( ) . par_visit_item_likes_in_module ( module_def_id, & mut ImplWfCheck { tcx } ) ;
6667}
6768
6869pub fn provide ( providers : & mut Providers < ' _ > ) {
@@ -73,18 +74,18 @@ struct ImplWfCheck<'tcx> {
7374 tcx : TyCtxt < ' tcx > ,
7475}
7576
76- impl ItemLikeVisitor < ' tcx > for ImplWfCheck < ' tcx > {
77- fn visit_item ( & mut self , item : & ' tcx hir:: Item < ' tcx > ) {
77+ impl ParItemLikeVisitor < ' tcx > for ImplWfCheck < ' tcx > {
78+ fn visit_item ( & self , item : & ' tcx hir:: Item < ' tcx > ) {
7879 if let hir:: ItemKind :: Impl ( .., ref impl_item_refs) = item. kind {
7980 let impl_def_id = self . tcx . hir ( ) . local_def_id ( item. hir_id ) ;
8081 enforce_impl_params_are_constrained ( self . tcx , impl_def_id, impl_item_refs) ;
8182 enforce_impl_items_are_distinct ( self . tcx , impl_item_refs) ;
8283 }
8384 }
8485
85- fn visit_trait_item ( & mut self , _trait_item : & ' tcx hir:: TraitItem < ' tcx > ) { }
86+ fn visit_trait_item ( & self , _trait_item : & ' tcx hir:: TraitItem < ' tcx > ) { }
8687
87- fn visit_impl_item ( & mut self , _impl_item : & ' tcx hir:: ImplItem < ' tcx > ) { }
88+ fn visit_impl_item ( & self , _impl_item : & ' tcx hir:: ImplItem < ' tcx > ) { }
8889}
8990
9091fn enforce_impl_params_are_constrained (
0 commit comments