@@ -11,7 +11,7 @@ use crate::ast::*;
1111use crate :: ptr:: P ;
1212use crate :: token:: { self , Token } ;
1313use crate :: tokenstream:: * ;
14- use crate :: visit:: AssocCtxt ;
14+ use crate :: visit:: { AssocCtxt , BoundKind } ;
1515
1616use rustc_data_structures:: flat_map_in_place:: FlatMapInPlace ;
1717use rustc_data_structures:: stack:: ensure_sufficient_stack;
@@ -256,7 +256,7 @@ pub trait MutVisitor: Sized {
256256 noop_flat_map_generic_param ( param, self )
257257 }
258258
259- fn visit_param_bound ( & mut self , tpb : & mut GenericBound ) {
259+ fn visit_param_bound ( & mut self , tpb : & mut GenericBound , _ctxt : BoundKind ) {
260260 noop_visit_param_bound ( tpb, self ) ;
261261 }
262262
@@ -386,8 +386,8 @@ fn visit_thin_exprs<T: MutVisitor>(exprs: &mut ThinVec<P<Expr>>, vis: &mut T) {
386386}
387387
388388// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
389- fn visit_bounds < T : MutVisitor > ( bounds : & mut GenericBounds , vis : & mut T ) {
390- visit_vec ( bounds, |bound| vis. visit_param_bound ( bound) ) ;
389+ fn visit_bounds < T : MutVisitor > ( bounds : & mut GenericBounds , ctxt : BoundKind , vis : & mut T ) {
390+ visit_vec ( bounds, |bound| vis. visit_param_bound ( bound, ctxt ) ) ;
391391}
392392
393393// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
@@ -479,7 +479,7 @@ fn noop_visit_assoc_item_constraint<T: MutVisitor>(
479479 Term :: Ty ( ty) => vis. visit_ty ( ty) ,
480480 Term :: Const ( c) => vis. visit_anon_const ( c) ,
481481 } ,
482- AssocItemConstraintKind :: Bound { bounds } => visit_bounds ( bounds, vis) ,
482+ AssocItemConstraintKind :: Bound { bounds } => visit_bounds ( bounds, BoundKind :: Bound , vis) ,
483483 }
484484 vis. visit_span ( span) ;
485485}
@@ -520,11 +520,11 @@ pub fn noop_visit_ty<T: MutVisitor>(ty: &mut P<Ty>, vis: &mut T) {
520520 }
521521 TyKind :: Typeof ( expr) => vis. visit_anon_const ( expr) ,
522522 TyKind :: TraitObject ( bounds, _syntax) => {
523- visit_vec ( bounds, |bound| vis. visit_param_bound ( bound) )
523+ visit_vec ( bounds, |bound| vis. visit_param_bound ( bound, BoundKind :: TraitObject ) )
524524 }
525525 TyKind :: ImplTrait ( id, bounds) => {
526526 vis. visit_id ( id) ;
527- visit_vec ( bounds, |bound| vis. visit_param_bound ( bound) ) ;
527+ visit_vec ( bounds, |bound| vis. visit_param_bound ( bound, BoundKind :: Impl ) ) ;
528528 }
529529 TyKind :: MacCall ( mac) => vis. visit_mac_call ( mac) ,
530530 TyKind :: AnonStruct ( id, fields) | TyKind :: AnonUnion ( id, fields) => {
@@ -990,13 +990,13 @@ fn noop_visit_where_predicate<T: MutVisitor>(pred: &mut WherePredicate, vis: &mu
990990 let WhereBoundPredicate { span, bound_generic_params, bounded_ty, bounds } = bp;
991991 bound_generic_params. flat_map_in_place ( |param| vis. flat_map_generic_param ( param) ) ;
992992 vis. visit_ty ( bounded_ty) ;
993- visit_vec ( bounds, |bound| vis. visit_param_bound ( bound) ) ;
993+ visit_vec ( bounds, |bound| vis. visit_param_bound ( bound, BoundKind :: Bound ) ) ;
994994 vis. visit_span ( span) ;
995995 }
996996 WherePredicate :: RegionPredicate ( rp) => {
997997 let WhereRegionPredicate { span, lifetime, bounds } = rp;
998998 noop_visit_lifetime ( lifetime, vis) ;
999- visit_vec ( bounds, |bound| noop_visit_param_bound ( bound, vis ) ) ;
999+ visit_vec ( bounds, |bound| vis . visit_param_bound ( bound, BoundKind :: Bound ) ) ;
10001000 vis. visit_span ( span) ;
10011001 }
10021002 WherePredicate :: EqPredicate ( ep) => {
@@ -1110,7 +1110,7 @@ impl NoopVisitItemKind for ItemKind {
11101110 ItemKind :: TyAlias ( box TyAlias { defaultness, generics, where_clauses, bounds, ty } ) => {
11111111 visit_defaultness ( defaultness, vis) ;
11121112 vis. visit_generics ( generics) ;
1113- visit_bounds ( bounds, vis) ;
1113+ visit_bounds ( bounds, BoundKind :: Bound , vis) ;
11141114 visit_opt ( ty, |ty| vis. visit_ty ( ty) ) ;
11151115 noop_visit_ty_alias_where_clauses ( where_clauses, vis) ;
11161116 }
@@ -1144,12 +1144,12 @@ impl NoopVisitItemKind for ItemKind {
11441144 ItemKind :: Trait ( box Trait { safety, is_auto : _, generics, bounds, items } ) => {
11451145 visit_safety ( safety, vis) ;
11461146 vis. visit_generics ( generics) ;
1147- visit_bounds ( bounds, vis) ;
1147+ visit_bounds ( bounds, BoundKind :: Bound , vis) ;
11481148 items. flat_map_in_place ( |item| vis. flat_map_assoc_item ( item, AssocCtxt :: Trait ) ) ;
11491149 }
11501150 ItemKind :: TraitAlias ( generics, bounds) => {
11511151 vis. visit_generics ( generics) ;
1152- visit_bounds ( bounds, vis) ;
1152+ visit_bounds ( bounds, BoundKind :: Bound , vis) ;
11531153 }
11541154 ItemKind :: MacCall ( m) => vis. visit_mac_call ( m) ,
11551155 ItemKind :: MacroDef ( def) => vis. visit_macro_def ( def) ,
@@ -1211,7 +1211,7 @@ impl NoopVisitItemKind for AssocItemKind {
12111211 } ) => {
12121212 visit_defaultness ( defaultness, visitor) ;
12131213 visitor. visit_generics ( generics) ;
1214- visit_bounds ( bounds, visitor) ;
1214+ visit_bounds ( bounds, BoundKind :: Bound , visitor) ;
12151215 visit_opt ( ty, |ty| visitor. visit_ty ( ty) ) ;
12161216 noop_visit_ty_alias_where_clauses ( where_clauses, visitor) ;
12171217 }
@@ -1318,7 +1318,7 @@ impl NoopVisitItemKind for ForeignItemKind {
13181318 } ) => {
13191319 visit_defaultness ( defaultness, visitor) ;
13201320 visitor. visit_generics ( generics) ;
1321- visit_bounds ( bounds, visitor) ;
1321+ visit_bounds ( bounds, BoundKind :: Bound , visitor) ;
13221322 visit_opt ( ty, |ty| visitor. visit_ty ( ty) ) ;
13231323 noop_visit_ty_alias_where_clauses ( where_clauses, visitor) ;
13241324 }
0 commit comments