@@ -1263,6 +1263,34 @@ macro_rules! make_ast_visitor {
12631263 return_result!( V )
12641264 }
12651265
1266+ pub fn walk_where_predicate<$( $lt, ) ? V : $trait$( <$lt>) ?>(
1267+ vis: & mut V ,
1268+ predicate: ref_t!( WherePredicate )
1269+ ) -> result!( V ) {
1270+ match predicate {
1271+ WherePredicate :: BoundPredicate ( bp) => {
1272+ let WhereBoundPredicate { span, bound_generic_params, bounded_ty, bounds } = bp;
1273+ visit_list!( vis, visit_generic_param, flat_map_generic_param, bound_generic_params) ;
1274+ try_v!( vis. visit_ty( bounded_ty) ) ;
1275+ visit_list!( vis, visit_param_bound, bounds; BoundKind :: Bound ) ;
1276+ try_v!( visit_span!( vis, span) ) ;
1277+ }
1278+ WherePredicate :: RegionPredicate ( rp) => {
1279+ let WhereRegionPredicate { span, lifetime, bounds } = rp;
1280+ try_v!( vis. visit_lifetime( lifetime, LifetimeCtxt :: Bound ) ) ;
1281+ visit_list!( vis, visit_param_bound, bounds; BoundKind :: Bound ) ;
1282+ try_v!( visit_span!( vis, span) ) ;
1283+ }
1284+ WherePredicate :: EqPredicate ( ep) => {
1285+ let WhereEqPredicate { span, lhs_ty, rhs_ty } = ep;
1286+ try_v!( vis. visit_ty( lhs_ty) ) ;
1287+ try_v!( vis. visit_ty( rhs_ty) ) ;
1288+ try_v!( visit_span!( vis, span) ) ;
1289+ }
1290+ }
1291+ return_result!( V )
1292+ }
1293+
12661294 derive_copy_clone!{
12671295 #[ derive( Debug ) ]
12681296 pub enum FnKind <' a> {
@@ -1588,33 +1616,6 @@ pub mod visit {
15881616
15891617 make_ast_visitor ! ( Visitor <' ast>) ;
15901618
1591- pub fn walk_where_predicate < ' a , V : Visitor < ' a > > (
1592- visitor : & mut V ,
1593- predicate : & ' a WherePredicate ,
1594- ) -> V :: Result {
1595- match predicate {
1596- WherePredicate :: BoundPredicate ( WhereBoundPredicate {
1597- bounded_ty,
1598- bounds,
1599- bound_generic_params,
1600- span : _,
1601- } ) => {
1602- walk_list ! ( visitor, visit_generic_param, bound_generic_params) ;
1603- try_visit ! ( visitor. visit_ty( bounded_ty) ) ;
1604- walk_list ! ( visitor, visit_param_bound, bounds, BoundKind :: Bound ) ;
1605- }
1606- WherePredicate :: RegionPredicate ( WhereRegionPredicate { lifetime, bounds, span : _ } ) => {
1607- try_visit ! ( visitor. visit_lifetime( lifetime, LifetimeCtxt :: Bound ) ) ;
1608- walk_list ! ( visitor, visit_param_bound, bounds, BoundKind :: Bound ) ;
1609- }
1610- WherePredicate :: EqPredicate ( WhereEqPredicate { lhs_ty, rhs_ty, span : _ } ) => {
1611- try_visit ! ( visitor. visit_ty( lhs_ty) ) ;
1612- try_visit ! ( visitor. visit_ty( rhs_ty) ) ;
1613- }
1614- }
1615- V :: Result :: output ( )
1616- }
1617-
16181619 pub fn walk_assoc_item < ' a , V : Visitor < ' a > > (
16191620 visitor : & mut V ,
16201621 item : & ' a Item < AssocItemKind > ,
@@ -2289,30 +2290,6 @@ pub mod mut_visit {
22892290 vis. visit_span ( span_after) ;
22902291 }
22912292
2292- fn walk_where_predicate < T : MutVisitor > ( vis : & mut T , pred : & mut WherePredicate ) {
2293- match pred {
2294- WherePredicate :: BoundPredicate ( bp) => {
2295- let WhereBoundPredicate { span, bound_generic_params, bounded_ty, bounds } = bp;
2296- bound_generic_params. flat_map_in_place ( |param| vis. flat_map_generic_param ( param) ) ;
2297- vis. visit_ty ( bounded_ty) ;
2298- visit_vec ( bounds, |bound| vis. visit_param_bound ( bound, BoundKind :: Bound ) ) ;
2299- vis. visit_span ( span) ;
2300- }
2301- WherePredicate :: RegionPredicate ( rp) => {
2302- let WhereRegionPredicate { span, lifetime, bounds } = rp;
2303- vis. visit_lifetime ( lifetime, LifetimeCtxt :: Bound ) ;
2304- visit_vec ( bounds, |bound| vis. visit_param_bound ( bound, BoundKind :: Bound ) ) ;
2305- vis. visit_span ( span) ;
2306- }
2307- WherePredicate :: EqPredicate ( ep) => {
2308- let WhereEqPredicate { span, lhs_ty, rhs_ty } = ep;
2309- vis. visit_ty ( lhs_ty) ;
2310- vis. visit_ty ( rhs_ty) ;
2311- vis. visit_span ( span) ;
2312- }
2313- }
2314- }
2315-
23162293 fn visit_const_item < T : MutVisitor > (
23172294 ConstItem { defaultness, generics, ty, expr } : & mut ConstItem ,
23182295 visitor : & mut T ,
0 commit comments