@@ -8,6 +8,7 @@ use rustc_hir as hir;
8
8
use rustc_hir:: def_id:: { DefId , LocalDefId } ;
9
9
use rustc_hir:: intravisit as hir_visit;
10
10
use rustc_hir:: intravisit:: Visitor ;
11
+ use rustc_hir:: itemlikevisit:: ParItemLikeVisitor ;
11
12
use rustc_hir:: lang_items;
12
13
use rustc_hir:: ItemKind ;
13
14
use rustc_middle:: hir:: map as hir_map;
@@ -1373,6 +1374,7 @@ fn check_false_global_bounds(fcx: &FnCtxt<'_, '_>, span: Span, id: hir::HirId) {
1373
1374
fcx. select_all_obligations_or_error ( ) ;
1374
1375
}
1375
1376
1377
+ #[ derive( Clone , Copy ) ]
1376
1378
pub struct CheckTypeWellFormedVisitor < ' tcx > {
1377
1379
tcx : TyCtxt < ' tcx > ,
1378
1380
}
@@ -1383,6 +1385,20 @@ impl CheckTypeWellFormedVisitor<'tcx> {
1383
1385
}
1384
1386
}
1385
1387
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
+
1386
1402
impl Visitor < ' tcx > for CheckTypeWellFormedVisitor < ' tcx > {
1387
1403
type Map = hir_map:: Map < ' tcx > ;
1388
1404
@@ -1413,8 +1429,7 @@ impl Visitor<'tcx> for CheckTypeWellFormedVisitor<'tcx> {
1413
1429
1414
1430
fn visit_generic_param ( & mut self , p : & ' tcx hir:: GenericParam < ' tcx > ) {
1415
1431
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) ;
1418
1433
}
1419
1434
}
1420
1435
0 commit comments