@@ -12,10 +12,11 @@ use crate::constrained_generic_params as cgp;
12
12
use rustc:: ty:: query:: Providers ;
13
13
use rustc:: ty:: { self , TyCtxt , TypeFoldable } ;
14
14
use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
15
+ use rustc_data_structures:: sync:: par_for_each;
15
16
use rustc_errors:: struct_span_err;
16
17
use rustc_hir as hir;
17
18
use rustc_hir:: def_id:: DefId ;
18
- use rustc_hir:: itemlikevisit:: ItemLikeVisitor ;
19
+ use rustc_hir:: itemlikevisit:: ParItemLikeVisitor ;
19
20
use std:: collections:: hash_map:: Entry :: { Occupied , Vacant } ;
20
21
21
22
use rustc_span:: Span ;
@@ -56,13 +57,13 @@ pub fn impl_wf_check(tcx: TyCtxt<'_>) {
56
57
// We will tag this as part of the WF check -- logically, it is,
57
58
// but it's one that we must perform earlier than the rest of
58
59
// WfCheck.
59
- for & module in tcx. hir ( ) . krate ( ) . modules . keys ( ) {
60
+ par_for_each ( & tcx. hir ( ) . krate ( ) . modules , | ( & module , _ ) | {
60
61
tcx. ensure ( ) . check_mod_impl_wf ( tcx. hir ( ) . local_def_id ( module) ) ;
61
- }
62
+ } ) ;
62
63
}
63
64
64
65
fn 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 } ) ;
66
67
}
67
68
68
69
pub fn provide ( providers : & mut Providers < ' _ > ) {
@@ -73,18 +74,18 @@ struct ImplWfCheck<'tcx> {
73
74
tcx : TyCtxt < ' tcx > ,
74
75
}
75
76
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 > ) {
78
79
if let hir:: ItemKind :: Impl ( .., ref impl_item_refs) = item. kind {
79
80
let impl_def_id = self . tcx . hir ( ) . local_def_id ( item. hir_id ) ;
80
81
enforce_impl_params_are_constrained ( self . tcx , impl_def_id, impl_item_refs) ;
81
82
enforce_impl_items_are_distinct ( self . tcx , impl_item_refs) ;
82
83
}
83
84
}
84
85
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 > ) { }
86
87
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 > ) { }
88
89
}
89
90
90
91
fn enforce_impl_params_are_constrained (
0 commit comments