@@ -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
@@ -386,8 +386,8 @@ fn visit_thin_exprs<T: MutVisitor>(exprs: &mut ThinVec<P<Expr>>, vis: &mut T) {
386
386
}
387
387
388
388
// 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 ) ) ;
391
391
}
392
392
393
393
// No `noop_` prefix because there isn't a corresponding method in `MutVisitor`.
@@ -479,7 +479,7 @@ fn noop_visit_assoc_item_constraint<T: MutVisitor>(
479
479
Term :: Ty ( ty) => vis. visit_ty ( ty) ,
480
480
Term :: Const ( c) => vis. visit_anon_const ( c) ,
481
481
} ,
482
- AssocItemConstraintKind :: Bound { bounds } => visit_bounds ( bounds, vis) ,
482
+ AssocItemConstraintKind :: Bound { bounds } => visit_bounds ( bounds, BoundKind :: Bound , vis) ,
483
483
}
484
484
vis. visit_span ( span) ;
485
485
}
@@ -520,11 +520,11 @@ pub fn noop_visit_ty<T: MutVisitor>(ty: &mut P<Ty>, vis: &mut T) {
520
520
}
521
521
TyKind :: Typeof ( expr) => vis. visit_anon_const ( expr) ,
522
522
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 ) )
524
524
}
525
525
TyKind :: ImplTrait ( id, bounds) => {
526
526
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 ) ) ;
528
528
}
529
529
TyKind :: MacCall ( mac) => vis. visit_mac_call ( mac) ,
530
530
TyKind :: AnonStruct ( id, fields) | TyKind :: AnonUnion ( id, fields) => {
@@ -990,13 +990,13 @@ fn noop_visit_where_predicate<T: MutVisitor>(pred: &mut WherePredicate, vis: &mu
990
990
let WhereBoundPredicate { span, bound_generic_params, bounded_ty, bounds } = bp;
991
991
bound_generic_params. flat_map_in_place ( |param| vis. flat_map_generic_param ( param) ) ;
992
992
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 ) ) ;
994
994
vis. visit_span ( span) ;
995
995
}
996
996
WherePredicate :: RegionPredicate ( rp) => {
997
997
let WhereRegionPredicate { span, lifetime, bounds } = rp;
998
998
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 ) ) ;
1000
1000
vis. visit_span ( span) ;
1001
1001
}
1002
1002
WherePredicate :: EqPredicate ( ep) => {
@@ -1110,7 +1110,7 @@ impl NoopVisitItemKind for ItemKind {
1110
1110
ItemKind :: TyAlias ( box TyAlias { defaultness, generics, where_clauses, bounds, ty } ) => {
1111
1111
visit_defaultness ( defaultness, vis) ;
1112
1112
vis. visit_generics ( generics) ;
1113
- visit_bounds ( bounds, vis) ;
1113
+ visit_bounds ( bounds, BoundKind :: Bound , vis) ;
1114
1114
visit_opt ( ty, |ty| vis. visit_ty ( ty) ) ;
1115
1115
noop_visit_ty_alias_where_clauses ( where_clauses, vis) ;
1116
1116
}
@@ -1144,12 +1144,12 @@ impl NoopVisitItemKind for ItemKind {
1144
1144
ItemKind :: Trait ( box Trait { safety, is_auto : _, generics, bounds, items } ) => {
1145
1145
visit_safety ( safety, vis) ;
1146
1146
vis. visit_generics ( generics) ;
1147
- visit_bounds ( bounds, vis) ;
1147
+ visit_bounds ( bounds, BoundKind :: Bound , vis) ;
1148
1148
items. flat_map_in_place ( |item| vis. flat_map_assoc_item ( item, AssocCtxt :: Trait ) ) ;
1149
1149
}
1150
1150
ItemKind :: TraitAlias ( generics, bounds) => {
1151
1151
vis. visit_generics ( generics) ;
1152
- visit_bounds ( bounds, vis) ;
1152
+ visit_bounds ( bounds, BoundKind :: Bound , vis) ;
1153
1153
}
1154
1154
ItemKind :: MacCall ( m) => vis. visit_mac_call ( m) ,
1155
1155
ItemKind :: MacroDef ( def) => vis. visit_macro_def ( def) ,
@@ -1211,7 +1211,7 @@ impl NoopVisitItemKind for AssocItemKind {
1211
1211
} ) => {
1212
1212
visit_defaultness ( defaultness, visitor) ;
1213
1213
visitor. visit_generics ( generics) ;
1214
- visit_bounds ( bounds, visitor) ;
1214
+ visit_bounds ( bounds, BoundKind :: Bound , visitor) ;
1215
1215
visit_opt ( ty, |ty| visitor. visit_ty ( ty) ) ;
1216
1216
noop_visit_ty_alias_where_clauses ( where_clauses, visitor) ;
1217
1217
}
@@ -1318,7 +1318,7 @@ impl NoopVisitItemKind for ForeignItemKind {
1318
1318
} ) => {
1319
1319
visit_defaultness ( defaultness, visitor) ;
1320
1320
visitor. visit_generics ( generics) ;
1321
- visit_bounds ( bounds, visitor) ;
1321
+ visit_bounds ( bounds, BoundKind :: Bound , visitor) ;
1322
1322
visit_opt ( ty, |ty| visitor. visit_ty ( ty) ) ;
1323
1323
noop_visit_ty_alias_where_clauses ( where_clauses, visitor) ;
1324
1324
}
0 commit comments