@@ -8,6 +8,7 @@ use rustc_hir as hir;
88use rustc_hir:: def_id:: { DefId , LocalDefId } ;
99use rustc_hir:: intravisit as hir_visit;
1010use rustc_hir:: intravisit:: Visitor ;
11+ use rustc_hir:: itemlikevisit:: ParItemLikeVisitor ;
1112use rustc_hir:: lang_items;
1213use rustc_hir:: ItemKind ;
1314use rustc_middle:: hir:: map as hir_map;
@@ -1373,6 +1374,7 @@ fn check_false_global_bounds(fcx: &FnCtxt<'_, '_>, span: Span, id: hir::HirId) {
13731374 fcx. select_all_obligations_or_error ( ) ;
13741375}
13751376
1377+ #[ derive( Clone , Copy ) ]
13761378pub struct CheckTypeWellFormedVisitor < ' tcx > {
13771379 tcx : TyCtxt < ' tcx > ,
13781380}
@@ -1383,6 +1385,20 @@ impl CheckTypeWellFormedVisitor<'tcx> {
13831385 }
13841386}
13851387
1388+ impl ParItemLikeVisitor < ' tcx > for CheckTypeWellFormedVisitor < ' tcx > {
1389+ fn visit_item ( & self , i : & ' tcx hir:: Item < ' tcx > ) {
1390+ Visitor :: visit_item ( & mut self . clone ( ) , i) ;
1391+ }
1392+
1393+ fn visit_trait_item ( & self , trait_item : & ' tcx hir:: TraitItem < ' tcx > ) {
1394+ Visitor :: visit_trait_item ( & mut self . clone ( ) , trait_item) ;
1395+ }
1396+
1397+ fn visit_impl_item ( & self , impl_item : & ' tcx hir:: ImplItem < ' tcx > ) {
1398+ Visitor :: visit_impl_item ( & mut self . clone ( ) , impl_item) ;
1399+ }
1400+ }
1401+
13861402impl Visitor < ' tcx > for CheckTypeWellFormedVisitor < ' tcx > {
13871403 type Map = hir_map:: Map < ' tcx > ;
13881404
@@ -1413,8 +1429,7 @@ impl Visitor<'tcx> for CheckTypeWellFormedVisitor<'tcx> {
14131429
14141430 fn visit_generic_param ( & mut self , p : & ' tcx hir:: GenericParam < ' tcx > ) {
14151431 check_param_wf ( self . tcx , p) ;
1416- // No need to walk further here, there is nothing interesting
1417- // inside of generic params we don't already check in `check_param_wf`.
1432+ hir_visit:: walk_generic_param ( self , p) ;
14181433 }
14191434}
14201435
0 commit comments