@@ -11,7 +11,7 @@ use crate::ast::*;
11
11
use crate :: ptr:: P ;
12
12
use crate :: token:: { self , Token } ;
13
13
use crate :: tokenstream:: * ;
14
- use crate :: visit:: AssocCtxt ;
14
+ use crate :: visit:: { AssocCtxt , BoundKind } ;
15
15
16
16
use rustc_data_structures:: flat_map_in_place:: FlatMapInPlace ;
17
17
use rustc_data_structures:: stack:: ensure_sufficient_stack;
@@ -256,7 +256,7 @@ pub trait MutVisitor: Sized {
256
256
noop_flat_map_generic_param ( param, self )
257
257
}
258
258
259
- fn visit_param_bound ( & mut self , tpb : & mut GenericBound ) {
259
+ fn visit_param_bound ( & mut self , tpb : & mut GenericBound , _ctxt : BoundKind ) {
260
260
noop_visit_param_bound ( tpb, self ) ;
261
261
}
262
262
@@ -375,8 +375,8 @@ fn visit_thin_exprs<T: MutVisitor>(exprs: &mut ThinVec<P<Expr>>, vis: &mut T) {
375
375
}
376
376
377
377
// 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 ) ) ;
380
380
}
381
381
382
382
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
@@ -468,7 +468,7 @@ fn noop_visit_assoc_item_constraint<T: MutVisitor>(
468
468
Term :: Ty ( ty) => vis. visit_ty ( ty) ,
469
469
Term :: Const ( c) => vis. visit_anon_const ( c) ,
470
470
} ,
471
- AssocItemConstraintKind :: Bound { bounds } => visit_bounds ( bounds, vis) ,
471
+ AssocItemConstraintKind :: Bound { bounds } => visit_bounds ( bounds, BoundKind :: Bound , vis) ,
472
472
}
473
473
vis. visit_span ( span) ;
474
474
}
@@ -509,11 +509,11 @@ pub fn noop_visit_ty<T: MutVisitor>(ty: &mut P<Ty>, vis: &mut T) {
509
509
}
510
510
TyKind :: Typeof ( expr) => vis. visit_anon_const ( expr) ,
511
511
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 ) )
513
513
}
514
514
TyKind :: ImplTrait ( id, bounds) => {
515
515
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 ) ) ;
517
517
}
518
518
TyKind :: MacCall ( mac) => vis. visit_mac_call ( mac) ,
519
519
TyKind :: AnonStruct ( id, fields) | TyKind :: AnonUnion ( id, fields) => {
@@ -926,7 +926,7 @@ pub fn noop_flat_map_generic_param<T: MutVisitor>(
926
926
vis. visit_id ( id) ;
927
927
visit_attrs ( attrs, vis) ;
928
928
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 ) ) ;
930
930
match kind {
931
931
GenericParamKind :: Lifetime => { }
932
932
GenericParamKind :: Type { default } => {
@@ -979,13 +979,13 @@ fn noop_visit_where_predicate<T: MutVisitor>(pred: &mut WherePredicate, vis: &mu
979
979
let WhereBoundPredicate { span, bound_generic_params, bounded_ty, bounds } = bp;
980
980
bound_generic_params. flat_map_in_place ( |param| vis. flat_map_generic_param ( param) ) ;
981
981
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 ) ) ;
983
983
vis. visit_span ( span) ;
984
984
}
985
985
WherePredicate :: RegionPredicate ( rp) => {
986
986
let WhereRegionPredicate { span, lifetime, bounds } = rp;
987
987
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 ) ) ;
989
989
vis. visit_span ( span) ;
990
990
}
991
991
WherePredicate :: EqPredicate ( ep) => {
@@ -1099,7 +1099,7 @@ impl NoopVisitItemKind for ItemKind {
1099
1099
ItemKind :: TyAlias ( box TyAlias { defaultness, generics, where_clauses, bounds, ty } ) => {
1100
1100
visit_defaultness ( defaultness, vis) ;
1101
1101
vis. visit_generics ( generics) ;
1102
- visit_bounds ( bounds, vis) ;
1102
+ visit_bounds ( bounds, BoundKind :: Bound , vis) ;
1103
1103
visit_opt ( ty, |ty| vis. visit_ty ( ty) ) ;
1104
1104
noop_visit_ty_alias_where_clauses ( where_clauses, vis) ;
1105
1105
}
@@ -1133,12 +1133,12 @@ impl NoopVisitItemKind for ItemKind {
1133
1133
ItemKind :: Trait ( box Trait { safety, is_auto : _, generics, bounds, items } ) => {
1134
1134
visit_safety ( safety, vis) ;
1135
1135
vis. visit_generics ( generics) ;
1136
- visit_bounds ( bounds, vis) ;
1136
+ visit_bounds ( bounds, BoundKind :: Bound , vis) ;
1137
1137
items. flat_map_in_place ( |item| vis. flat_map_assoc_item ( item, AssocCtxt :: Trait ) ) ;
1138
1138
}
1139
1139
ItemKind :: TraitAlias ( generics, bounds) => {
1140
1140
vis. visit_generics ( generics) ;
1141
- visit_bounds ( bounds, vis) ;
1141
+ visit_bounds ( bounds, BoundKind :: Bound , vis) ;
1142
1142
}
1143
1143
ItemKind :: MacCall ( m) => vis. visit_mac_call ( m) ,
1144
1144
ItemKind :: MacroDef ( def) => vis. visit_macro_def ( def) ,
@@ -1200,7 +1200,7 @@ impl NoopVisitItemKind for AssocItemKind {
1200
1200
} ) => {
1201
1201
visit_defaultness ( defaultness, visitor) ;
1202
1202
visitor. visit_generics ( generics) ;
1203
- visit_bounds ( bounds, visitor) ;
1203
+ visit_bounds ( bounds, BoundKind :: Bound , visitor) ;
1204
1204
visit_opt ( ty, |ty| visitor. visit_ty ( ty) ) ;
1205
1205
noop_visit_ty_alias_where_clauses ( where_clauses, visitor) ;
1206
1206
}
@@ -1307,7 +1307,7 @@ impl NoopVisitItemKind for ForeignItemKind {
1307
1307
} ) => {
1308
1308
visit_defaultness ( defaultness, visitor) ;
1309
1309
visitor. visit_generics ( generics) ;
1310
- visit_bounds ( bounds, visitor) ;
1310
+ visit_bounds ( bounds, BoundKind :: Bound , visitor) ;
1311
1311
visit_opt ( ty, |ty| visitor. visit_ty ( ty) ) ;
1312
1312
noop_visit_ty_alias_where_clauses ( where_clauses, visitor) ;
1313
1313
}
0 commit comments