@@ -14,6 +14,7 @@ use min_specialization::check_min_specialization;
14
14
use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
15
15
use rustc_errors:: struct_span_err;
16
16
use rustc_hir as hir;
17
+ use rustc_hir:: def:: DefKind ;
17
18
use rustc_hir:: def_id:: LocalDefId ;
18
19
use rustc_hir:: itemlikevisit:: ItemLikeVisitor ;
19
20
use rustc_middle:: ty:: query:: Providers ;
@@ -63,8 +64,19 @@ pub fn impl_wf_check(tcx: TyCtxt<'_>) {
63
64
64
65
fn check_mod_impl_wf ( tcx : TyCtxt < ' _ > , module_def_id : LocalDefId ) {
65
66
let min_specialization = tcx. features ( ) . min_specialization ;
66
- tcx. hir ( )
67
- . visit_item_likes_in_module ( module_def_id, & mut ImplWfCheck { tcx, min_specialization } ) ;
67
+ let module = tcx. hir_module_items ( module_def_id) ;
68
+ for id in module. items ( ) {
69
+ if matches ! ( tcx. hir( ) . def_kind( id. def_id) , DefKind :: Impl ) {
70
+ let item = tcx. hir ( ) . item ( id) ;
71
+ if let hir:: ItemKind :: Impl ( ref impl_) = item. kind {
72
+ enforce_impl_params_are_constrained ( tcx, item. def_id , impl_. items ) ;
73
+ enforce_impl_items_are_distinct ( tcx, impl_. items ) ;
74
+ if min_specialization {
75
+ check_min_specialization ( tcx, item. def_id . to_def_id ( ) , item. span ) ;
76
+ }
77
+ }
78
+ }
79
+ }
68
80
}
69
81
70
82
pub fn provide ( providers : & mut Providers ) {
0 commit comments