@@ -1255,6 +1255,34 @@ macro_rules! make_ast_visitor {
1255
1255
return_result!( V )
1256
1256
}
1257
1257
1258
+ pub fn walk_where_predicate<$( $lt, ) ? V : $trait$( <$lt>) ?>(
1259
+ vis: & mut V ,
1260
+ predicate: ref_t!( WherePredicate )
1261
+ ) -> result!( V ) {
1262
+ match predicate {
1263
+ WherePredicate :: BoundPredicate ( bp) => {
1264
+ let WhereBoundPredicate { span, bound_generic_params, bounded_ty, bounds } = bp;
1265
+ visit_list!( vis, visit_generic_param, flat_map_generic_param, bound_generic_params) ;
1266
+ try_v!( vis. visit_ty( bounded_ty) ) ;
1267
+ visit_list!( vis, visit_param_bound, bounds; BoundKind :: Bound ) ;
1268
+ try_v!( visit_span!( vis, span) ) ;
1269
+ }
1270
+ WherePredicate :: RegionPredicate ( rp) => {
1271
+ let WhereRegionPredicate { span, lifetime, bounds } = rp;
1272
+ try_v!( vis. visit_lifetime( lifetime, LifetimeCtxt :: Bound ) ) ;
1273
+ visit_list!( vis, visit_param_bound, bounds; BoundKind :: Bound ) ;
1274
+ try_v!( visit_span!( vis, span) ) ;
1275
+ }
1276
+ WherePredicate :: EqPredicate ( ep) => {
1277
+ let WhereEqPredicate { span, lhs_ty, rhs_ty } = ep;
1278
+ try_v!( vis. visit_ty( lhs_ty) ) ;
1279
+ try_v!( vis. visit_ty( rhs_ty) ) ;
1280
+ try_v!( visit_span!( vis, span) ) ;
1281
+ }
1282
+ }
1283
+ return_result!( V )
1284
+ }
1285
+
1258
1286
derive_copy_clone!{
1259
1287
#[ derive( Debug ) ]
1260
1288
pub enum FnKind <' a> {
@@ -1590,33 +1618,6 @@ pub mod visit {
1590
1618
V :: Result :: output ( )
1591
1619
}
1592
1620
1593
- pub fn walk_where_predicate < ' a , V : Visitor < ' a > > (
1594
- visitor : & mut V ,
1595
- predicate : & ' a WherePredicate ,
1596
- ) -> V :: Result {
1597
- match predicate {
1598
- WherePredicate :: BoundPredicate ( WhereBoundPredicate {
1599
- bounded_ty,
1600
- bounds,
1601
- bound_generic_params,
1602
- span : _,
1603
- } ) => {
1604
- walk_list ! ( visitor, visit_generic_param, bound_generic_params) ;
1605
- try_visit ! ( visitor. visit_ty( bounded_ty) ) ;
1606
- walk_list ! ( visitor, visit_param_bound, bounds, BoundKind :: Bound ) ;
1607
- }
1608
- WherePredicate :: RegionPredicate ( WhereRegionPredicate { lifetime, bounds, span : _ } ) => {
1609
- try_visit ! ( visitor. visit_lifetime( lifetime, LifetimeCtxt :: Bound ) ) ;
1610
- walk_list ! ( visitor, visit_param_bound, bounds, BoundKind :: Bound ) ;
1611
- }
1612
- WherePredicate :: EqPredicate ( WhereEqPredicate { lhs_ty, rhs_ty, span : _ } ) => {
1613
- try_visit ! ( visitor. visit_ty( lhs_ty) ) ;
1614
- try_visit ! ( visitor. visit_ty( rhs_ty) ) ;
1615
- }
1616
- }
1617
- V :: Result :: output ( )
1618
- }
1619
-
1620
1621
pub fn walk_assoc_item < ' a , V : Visitor < ' a > > (
1621
1622
visitor : & mut V ,
1622
1623
item : & ' a Item < AssocItemKind > ,
@@ -2291,30 +2292,6 @@ pub mod mut_visit {
2291
2292
vis. visit_span ( span_after) ;
2292
2293
}
2293
2294
2294
- fn walk_where_predicate < T : MutVisitor > ( vis : & mut T , pred : & mut WherePredicate ) {
2295
- match pred {
2296
- WherePredicate :: BoundPredicate ( bp) => {
2297
- let WhereBoundPredicate { span, bound_generic_params, bounded_ty, bounds } = bp;
2298
- bound_generic_params. flat_map_in_place ( |param| vis. flat_map_generic_param ( param) ) ;
2299
- vis. visit_ty ( bounded_ty) ;
2300
- visit_vec ( bounds, |bound| vis. visit_param_bound ( bound, BoundKind :: Bound ) ) ;
2301
- vis. visit_span ( span) ;
2302
- }
2303
- WherePredicate :: RegionPredicate ( rp) => {
2304
- let WhereRegionPredicate { span, lifetime, bounds } = rp;
2305
- vis. visit_lifetime ( lifetime, LifetimeCtxt :: Bound ) ;
2306
- visit_vec ( bounds, |bound| vis. visit_param_bound ( bound, BoundKind :: Bound ) ) ;
2307
- vis. visit_span ( span) ;
2308
- }
2309
- WherePredicate :: EqPredicate ( ep) => {
2310
- let WhereEqPredicate { span, lhs_ty, rhs_ty } = ep;
2311
- vis. visit_ty ( lhs_ty) ;
2312
- vis. visit_ty ( rhs_ty) ;
2313
- vis. visit_span ( span) ;
2314
- }
2315
- }
2316
- }
2317
-
2318
2295
fn visit_const_item < T : MutVisitor > (
2319
2296
ConstItem { defaultness, generics, ty, expr } : & mut ConstItem ,
2320
2297
visitor : & mut T ,
0 commit comments