@@ -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
@@ -375,8 +375,8 @@ fn visit_thin_exprs<T: MutVisitor>(exprs: &mut ThinVec<P<Expr>>, vis: &mut T) {
375375}
376376
377377// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
378- fn visit_bounds < T : MutVisitor > ( bounds : & mut GenericBounds , vis : & mut T ) {
379- visit_vec ( bounds, |bound| vis. visit_param_bound ( bound) ) ;
378+ fn visit_bounds < T : MutVisitor > ( bounds : & mut GenericBounds , ctxt : BoundKind , vis : & mut T ) {
379+ visit_vec ( bounds, |bound| vis. visit_param_bound ( bound, ctxt ) ) ;
380380}
381381
382382// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
@@ -468,7 +468,7 @@ fn noop_visit_assoc_item_constraint<T: MutVisitor>(
468468 Term :: Ty ( ty) => vis. visit_ty ( ty) ,
469469 Term :: Const ( c) => vis. visit_anon_const ( c) ,
470470 } ,
471- AssocItemConstraintKind :: Bound { bounds } => visit_bounds ( bounds, vis) ,
471+ AssocItemConstraintKind :: Bound { bounds } => visit_bounds ( bounds, BoundKind :: Bound , vis) ,
472472 }
473473 vis. visit_span ( span) ;
474474}
@@ -509,11 +509,11 @@ pub fn noop_visit_ty<T: MutVisitor>(ty: &mut P<Ty>, vis: &mut T) {
509509 }
510510 TyKind :: Typeof ( expr) => vis. visit_anon_const ( expr) ,
511511 TyKind :: TraitObject ( bounds, _syntax) => {
512- visit_vec ( bounds, |bound| vis. visit_param_bound ( bound) )
512+ visit_vec ( bounds, |bound| vis. visit_param_bound ( bound, BoundKind :: TraitObject ) )
513513 }
514514 TyKind :: ImplTrait ( id, bounds) => {
515515 vis. visit_id ( id) ;
516- visit_vec ( bounds, |bound| vis. visit_param_bound ( bound) ) ;
516+ visit_vec ( bounds, |bound| vis. visit_param_bound ( bound, BoundKind :: Impl ) ) ;
517517 }
518518 TyKind :: MacCall ( mac) => vis. visit_mac_call ( mac) ,
519519 TyKind :: AnonStruct ( id, fields) | TyKind :: AnonUnion ( id, fields) => {
@@ -926,7 +926,7 @@ pub fn noop_flat_map_generic_param<T: MutVisitor>(
926926 vis. visit_id ( id) ;
927927 visit_attrs ( attrs, vis) ;
928928 vis. visit_ident ( ident) ;
929- visit_vec ( bounds, |bound| vis. visit_param_bound ( bound) ) ;
929+ visit_vec ( bounds, |bound| vis. visit_param_bound ( bound, BoundKind :: Bound ) ) ;
930930 match kind {
931931 GenericParamKind :: Lifetime => { }
932932 GenericParamKind :: Type { default } => {
@@ -979,13 +979,13 @@ fn noop_visit_where_predicate<T: MutVisitor>(pred: &mut WherePredicate, vis: &mu
979979 let WhereBoundPredicate { span, bound_generic_params, bounded_ty, bounds } = bp;
980980 bound_generic_params. flat_map_in_place ( |param| vis. flat_map_generic_param ( param) ) ;
981981 vis. visit_ty ( bounded_ty) ;
982- visit_vec ( bounds, |bound| vis. visit_param_bound ( bound) ) ;
982+ visit_vec ( bounds, |bound| vis. visit_param_bound ( bound, BoundKind :: Bound ) ) ;
983983 vis. visit_span ( span) ;
984984 }
985985 WherePredicate :: RegionPredicate ( rp) => {
986986 let WhereRegionPredicate { span, lifetime, bounds } = rp;
987987 vis. visit_lifetime ( lifetime) ;
988- visit_vec ( bounds, |bound| noop_visit_param_bound ( bound, vis ) ) ;
988+ visit_vec ( bounds, |bound| vis . visit_param_bound ( bound, BoundKind :: Bound ) ) ;
989989 vis. visit_span ( span) ;
990990 }
991991 WherePredicate :: EqPredicate ( ep) => {
@@ -1099,7 +1099,7 @@ impl NoopVisitItemKind for ItemKind {
10991099 ItemKind :: TyAlias ( box TyAlias { defaultness, generics, where_clauses, bounds, ty } ) => {
11001100 visit_defaultness ( defaultness, vis) ;
11011101 vis. visit_generics ( generics) ;
1102- visit_bounds ( bounds, vis) ;
1102+ visit_bounds ( bounds, BoundKind :: Bound , vis) ;
11031103 visit_opt ( ty, |ty| vis. visit_ty ( ty) ) ;
11041104 noop_visit_ty_alias_where_clauses ( where_clauses, vis) ;
11051105 }
@@ -1133,12 +1133,12 @@ impl NoopVisitItemKind for ItemKind {
11331133 ItemKind :: Trait ( box Trait { safety, is_auto : _, generics, bounds, items } ) => {
11341134 visit_safety ( safety, vis) ;
11351135 vis. visit_generics ( generics) ;
1136- visit_bounds ( bounds, vis) ;
1136+ visit_bounds ( bounds, BoundKind :: Bound , vis) ;
11371137 items. flat_map_in_place ( |item| vis. flat_map_assoc_item ( item, AssocCtxt :: Trait ) ) ;
11381138 }
11391139 ItemKind :: TraitAlias ( generics, bounds) => {
11401140 vis. visit_generics ( generics) ;
1141- visit_bounds ( bounds, vis) ;
1141+ visit_bounds ( bounds, BoundKind :: Bound , vis) ;
11421142 }
11431143 ItemKind :: MacCall ( m) => vis. visit_mac_call ( m) ,
11441144 ItemKind :: MacroDef ( def) => vis. visit_macro_def ( def) ,
@@ -1200,7 +1200,7 @@ impl NoopVisitItemKind for AssocItemKind {
12001200 } ) => {
12011201 visit_defaultness ( defaultness, visitor) ;
12021202 visitor. visit_generics ( generics) ;
1203- visit_bounds ( bounds, visitor) ;
1203+ visit_bounds ( bounds, BoundKind :: Bound , visitor) ;
12041204 visit_opt ( ty, |ty| visitor. visit_ty ( ty) ) ;
12051205 noop_visit_ty_alias_where_clauses ( where_clauses, visitor) ;
12061206 }
@@ -1307,7 +1307,7 @@ impl NoopVisitItemKind for ForeignItemKind {
13071307 } ) => {
13081308 visit_defaultness ( defaultness, visitor) ;
13091309 visitor. visit_generics ( generics) ;
1310- visit_bounds ( bounds, visitor) ;
1310+ visit_bounds ( bounds, BoundKind :: Bound , visitor) ;
13111311 visit_opt ( ty, |ty| visitor. visit_ty ( ty) ) ;
13121312 noop_visit_ty_alias_where_clauses ( where_clauses, visitor) ;
13131313 }
0 commit comments