@@ -14,6 +14,7 @@ use min_specialization::check_min_specialization;
1414use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
1515use rustc_errors:: struct_span_err;
1616use rustc_hir as hir;
17+ use rustc_hir:: def:: DefKind ;
1718use rustc_hir:: def_id:: LocalDefId ;
1819use rustc_hir:: itemlikevisit:: ItemLikeVisitor ;
1920use rustc_middle:: ty:: query:: Providers ;
@@ -63,8 +64,19 @@ pub fn impl_wf_check(tcx: TyCtxt<'_>) {
6364
6465fn check_mod_impl_wf ( tcx : TyCtxt < ' _ > , module_def_id : LocalDefId ) {
6566 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+ }
6880}
6981
7082pub fn provide ( providers : & mut Providers ) {
0 commit comments