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