@@ -577,6 +577,34 @@ macro_rules! make_ast_visitor {
577
577
try_v!( visit_span!( vis, span) ) ;
578
578
return_result!( V )
579
579
}
580
+
581
+ pub fn walk_where_predicate<$( $lt, ) ? V : $trait$( <$lt>) ?>(
582
+ vis: & mut V ,
583
+ predicate: ref_t!( WherePredicate )
584
+ ) -> result!( V ) {
585
+ match predicate {
586
+ WherePredicate :: BoundPredicate ( bp) => {
587
+ let WhereBoundPredicate { span, bound_generic_params, bounded_ty, bounds } = bp;
588
+ visit_list!( vis, visit_generic_param, flat_map_generic_param, bound_generic_params) ;
589
+ try_v!( vis. visit_ty( bounded_ty) ) ;
590
+ visit_list!( vis, visit_param_bound, bounds; BoundKind :: Bound ) ;
591
+ try_v!( visit_span!( vis, span) ) ;
592
+ }
593
+ WherePredicate :: RegionPredicate ( rp) => {
594
+ let WhereRegionPredicate { span, lifetime, bounds } = rp;
595
+ try_v!( vis. visit_lifetime( lifetime, LifetimeCtxt :: Bound ) ) ;
596
+ visit_list!( vis, visit_param_bound, bounds; BoundKind :: Bound ) ;
597
+ try_v!( visit_span!( vis, span) ) ;
598
+ }
599
+ WherePredicate :: EqPredicate ( ep) => {
600
+ let WhereEqPredicate { span, lhs_ty, rhs_ty } = ep;
601
+ try_v!( vis. visit_ty( lhs_ty) ) ;
602
+ try_v!( vis. visit_ty( rhs_ty) ) ;
603
+ try_v!( visit_span!( vis, span) ) ;
604
+ }
605
+ }
606
+ return_result!( V )
607
+ }
580
608
}
581
609
}
582
610
@@ -1121,33 +1149,6 @@ pub mod visit {
1121
1149
V :: Result :: output ( )
1122
1150
}
1123
1151
1124
- pub fn walk_where_predicate < ' a , V : Visitor < ' a > > (
1125
- visitor : & mut V ,
1126
- predicate : & ' a WherePredicate ,
1127
- ) -> V :: Result {
1128
- match predicate {
1129
- WherePredicate :: BoundPredicate ( WhereBoundPredicate {
1130
- bounded_ty,
1131
- bounds,
1132
- bound_generic_params,
1133
- span : _,
1134
- } ) => {
1135
- walk_list ! ( visitor, visit_generic_param, bound_generic_params) ;
1136
- try_visit ! ( visitor. visit_ty( bounded_ty) ) ;
1137
- walk_list ! ( visitor, visit_param_bound, bounds, BoundKind :: Bound ) ;
1138
- }
1139
- WherePredicate :: RegionPredicate ( WhereRegionPredicate { lifetime, bounds, span : _ } ) => {
1140
- try_visit ! ( visitor. visit_lifetime( lifetime, LifetimeCtxt :: Bound ) ) ;
1141
- walk_list ! ( visitor, visit_param_bound, bounds, BoundKind :: Bound ) ;
1142
- }
1143
- WherePredicate :: EqPredicate ( WhereEqPredicate { lhs_ty, rhs_ty, span : _ } ) => {
1144
- try_visit ! ( visitor. visit_ty( lhs_ty) ) ;
1145
- try_visit ! ( visitor. visit_ty( rhs_ty) ) ;
1146
- }
1147
- }
1148
- V :: Result :: output ( )
1149
- }
1150
-
1151
1152
pub fn walk_fn < ' a , V : Visitor < ' a > > ( visitor : & mut V , kind : FnKind < ' a > ) -> V :: Result {
1152
1153
match kind {
1153
1154
FnKind :: Fn ( _ctxt, _ident, FnSig { header, decl, span : _ } , _vis, generics, body) => {
@@ -2170,30 +2171,6 @@ pub mod mut_visit {
2170
2171
vis. visit_span ( span_after) ;
2171
2172
}
2172
2173
2173
- fn walk_where_predicate < T : MutVisitor > ( vis : & mut T , pred : & mut WherePredicate ) {
2174
- match pred {
2175
- WherePredicate :: BoundPredicate ( bp) => {
2176
- let WhereBoundPredicate { span, bound_generic_params, bounded_ty, bounds } = bp;
2177
- bound_generic_params. flat_map_in_place ( |param| vis. flat_map_generic_param ( param) ) ;
2178
- vis. visit_ty ( bounded_ty) ;
2179
- visit_vec ( bounds, |bound| vis. visit_param_bound ( bound, BoundKind :: Bound ) ) ;
2180
- vis. visit_span ( span) ;
2181
- }
2182
- WherePredicate :: RegionPredicate ( rp) => {
2183
- let WhereRegionPredicate { span, lifetime, bounds } = rp;
2184
- vis. visit_lifetime ( lifetime, LifetimeCtxt :: Bound ) ;
2185
- visit_vec ( bounds, |bound| vis. visit_param_bound ( bound, BoundKind :: Bound ) ) ;
2186
- vis. visit_span ( span) ;
2187
- }
2188
- WherePredicate :: EqPredicate ( ep) => {
2189
- let WhereEqPredicate { span, lhs_ty, rhs_ty } = ep;
2190
- vis. visit_ty ( lhs_ty) ;
2191
- vis. visit_ty ( rhs_ty) ;
2192
- vis. visit_span ( span) ;
2193
- }
2194
- }
2195
- }
2196
-
2197
2174
fn walk_variant_data < T : MutVisitor > ( vis : & mut T , vdata : & mut VariantData ) {
2198
2175
match vdata {
2199
2176
VariantData :: Struct { fields, recovered : _ } => {
0 commit comments