@@ -35,10 +35,6 @@ macro_rules! mutability_dependent {
35
35
) -> Self :: Result {
36
36
walk_use_tree( self , use_tree, id)
37
37
}
38
- // TODO: hard because of different lifetime bounds
39
- fn visit_fn( & mut self , fk: FnKind <' ast>, _: Span , _: NodeId ) -> Self :: Result {
40
- walk_fn( self , fk)
41
- }
42
38
} ;
43
39
( mut $( $lf: lifetime) ?) => {
44
40
/// Mutable token visiting only exists for the `macro_rules` token marker and should not be
@@ -99,11 +95,6 @@ macro_rules! mutability_dependent {
99
95
walk_flat_map_item( self , i)
100
96
}
101
97
102
- /// `Span` and `NodeId` are mutated at the caller site.
103
- fn visit_fn( & mut self , fk: FnKind <' _>, _: Span , _: NodeId ) {
104
- walk_fn( self , fk)
105
- }
106
-
107
98
fn flat_map_assoc_item(
108
99
& mut self ,
109
100
i: P <AssocItem >,
@@ -211,10 +202,24 @@ macro_rules! mutability_helpers {
211
202
} ;
212
203
}
213
204
205
+ macro_rules! lifetime_helpers {
206
+ ( ) => {
207
+ macro_rules! fn_kind {
208
+ ( ) => { FnKind <' _> }
209
+ }
210
+ } ;
211
+ ( $lt: lifetime) => {
212
+ macro_rules! fn_kind {
213
+ ( ) => { FnKind <$lt> }
214
+ }
215
+ } ;
216
+ }
217
+
214
218
macro_rules! make_ast_visitor {
215
219
( $trait: ident $( <$lt: lifetime>) ? $( , $mut: ident) ?) => {
216
220
217
221
mutability_helpers!( $( $mut) ?) ;
222
+ lifetime_helpers!( $( $lt) ?) ;
218
223
219
224
macro_rules! result {
220
225
( ) => { result!( Self ) } ;
@@ -315,6 +320,11 @@ macro_rules! make_ast_visitor {
315
320
make_visit!{ WherePredicate , visit_where_predicate, walk_where_predicate, flat_map_where_predicate, walk_flat_map_where_predicate}
316
321
make_visit!{ P !( Ty ) , visit_ty, walk_ty, flat_map_ty, walk_flat_map_ty}
317
322
323
+ /// `MutVisitor`: `Span` and `NodeId` are mutated at the caller site.
324
+ fn visit_fn( & mut self , fk: fn_kind!( ) , _: Span , _: NodeId ) -> result!( ) {
325
+ walk_fn( self , fk)
326
+ }
327
+
318
328
fn visit_param_bound( & mut self , tpb: ref_t!( GenericBound ) , _ctxt: BoundKind ) -> result!( ) {
319
329
walk_param_bound( self , tpb)
320
330
}
0 commit comments