@@ -42,10 +42,10 @@ use syntax_pos::Span;
42
42
#[ derive( Copy , Clone ) ]
43
43
pub enum FnKind < ' a > {
44
44
/// `#[xxx] pub async/const/extern "Abi" fn foo()`
45
- ItemFn ( Ident , & ' a Generics , FnHeader , & ' a Visibility , & ' a [ Attribute ] ) ,
45
+ ItemFn ( Ident , & ' a Generics < ' a > , FnHeader , & ' a Visibility < ' a > , & ' a [ Attribute ] ) ,
46
46
47
47
/// `fn foo(&self)`
48
- Method ( Ident , & ' a FnSig < ' a > , Option < & ' a Visibility > , & ' a [ Attribute ] ) ,
48
+ Method ( Ident , & ' a FnSig < ' a > , Option < & ' a Visibility < ' a > > , & ' a [ Attribute ] ) ,
49
49
50
50
/// `|x, y| {}`
51
51
Closure ( & ' a [ Attribute ] ) ,
@@ -274,25 +274,25 @@ pub trait Visitor<'v>: Sized {
274
274
fn visit_expr ( & mut self , ex : & ' v Expr < ' v > ) {
275
275
walk_expr ( self , ex)
276
276
}
277
- fn visit_ty ( & mut self , t : & ' v Ty ) {
277
+ fn visit_ty ( & mut self , t : & ' v Ty < ' v > ) {
278
278
walk_ty ( self , t)
279
279
}
280
- fn visit_generic_param ( & mut self , p : & ' v GenericParam ) {
280
+ fn visit_generic_param ( & mut self , p : & ' v GenericParam < ' v > ) {
281
281
walk_generic_param ( self , p)
282
282
}
283
- fn visit_generics ( & mut self , g : & ' v Generics ) {
283
+ fn visit_generics ( & mut self , g : & ' v Generics < ' v > ) {
284
284
walk_generics ( self , g)
285
285
}
286
- fn visit_where_predicate ( & mut self , predicate : & ' v WherePredicate ) {
286
+ fn visit_where_predicate ( & mut self , predicate : & ' v WherePredicate < ' v > ) {
287
287
walk_where_predicate ( self , predicate)
288
288
}
289
- fn visit_fn_decl ( & mut self , fd : & ' v FnDecl ) {
289
+ fn visit_fn_decl ( & mut self , fd : & ' v FnDecl < ' v > ) {
290
290
walk_fn_decl ( self , fd)
291
291
}
292
- fn visit_fn ( & mut self , fk : FnKind < ' v > , fd : & ' v FnDecl , b : BodyId , s : Span , id : HirId ) {
292
+ fn visit_fn ( & mut self , fk : FnKind < ' v > , fd : & ' v FnDecl < ' v > , b : BodyId , s : Span , id : HirId ) {
293
293
walk_fn ( self , fk, fd, b, s, id)
294
294
}
295
- fn visit_use ( & mut self , path : & ' v Path , hir_id : HirId ) {
295
+ fn visit_use ( & mut self , path : & ' v Path < ' v > , hir_id : HirId ) {
296
296
walk_use ( self , path, hir_id)
297
297
}
298
298
fn visit_trait_item ( & mut self , ti : & ' v TraitItem < ' v > ) {
@@ -304,23 +304,23 @@ pub trait Visitor<'v>: Sized {
304
304
fn visit_impl_item ( & mut self , ii : & ' v ImplItem < ' v > ) {
305
305
walk_impl_item ( self , ii)
306
306
}
307
- fn visit_impl_item_ref ( & mut self , ii : & ' v ImplItemRef ) {
307
+ fn visit_impl_item_ref ( & mut self , ii : & ' v ImplItemRef < ' v > ) {
308
308
walk_impl_item_ref ( self , ii)
309
309
}
310
- fn visit_trait_ref ( & mut self , t : & ' v TraitRef ) {
310
+ fn visit_trait_ref ( & mut self , t : & ' v TraitRef < ' v > ) {
311
311
walk_trait_ref ( self , t)
312
312
}
313
- fn visit_param_bound ( & mut self , bounds : & ' v GenericBound ) {
313
+ fn visit_param_bound ( & mut self , bounds : & ' v GenericBound < ' v > ) {
314
314
walk_param_bound ( self , bounds)
315
315
}
316
- fn visit_poly_trait_ref ( & mut self , t : & ' v PolyTraitRef , m : TraitBoundModifier ) {
316
+ fn visit_poly_trait_ref ( & mut self , t : & ' v PolyTraitRef < ' v > , m : TraitBoundModifier ) {
317
317
walk_poly_trait_ref ( self , t, m)
318
318
}
319
319
fn visit_variant_data (
320
320
& mut self ,
321
321
s : & ' v VariantData < ' v > ,
322
322
_: Name ,
323
- _: & ' v Generics ,
323
+ _: & ' v Generics < ' v > ,
324
324
_parent_id : HirId ,
325
325
_: Span ,
326
326
) {
@@ -332,19 +332,19 @@ pub trait Visitor<'v>: Sized {
332
332
fn visit_enum_def (
333
333
& mut self ,
334
334
enum_definition : & ' v EnumDef < ' v > ,
335
- generics : & ' v Generics ,
335
+ generics : & ' v Generics < ' v > ,
336
336
item_id : HirId ,
337
337
_: Span ,
338
338
) {
339
339
walk_enum_def ( self , enum_definition, generics, item_id)
340
340
}
341
- fn visit_variant ( & mut self , v : & ' v Variant < ' v > , g : & ' v Generics , item_id : HirId ) {
341
+ fn visit_variant ( & mut self , v : & ' v Variant < ' v > , g : & ' v Generics < ' v > , item_id : HirId ) {
342
342
walk_variant ( self , v, g, item_id)
343
343
}
344
344
fn visit_label ( & mut self , label : & ' v Label ) {
345
345
walk_label ( self , label)
346
346
}
347
- fn visit_generic_arg ( & mut self , generic_arg : & ' v GenericArg ) {
347
+ fn visit_generic_arg ( & mut self , generic_arg : & ' v GenericArg < ' v > ) {
348
348
match generic_arg {
349
349
GenericArg :: Lifetime ( lt) => self . visit_lifetime ( lt) ,
350
350
GenericArg :: Type ( ty) => self . visit_ty ( ty) ,
@@ -354,26 +354,26 @@ pub trait Visitor<'v>: Sized {
354
354
fn visit_lifetime ( & mut self , lifetime : & ' v Lifetime ) {
355
355
walk_lifetime ( self , lifetime)
356
356
}
357
- fn visit_qpath ( & mut self , qpath : & ' v QPath , id : HirId , span : Span ) {
357
+ fn visit_qpath ( & mut self , qpath : & ' v QPath < ' v > , id : HirId , span : Span ) {
358
358
walk_qpath ( self , qpath, id, span)
359
359
}
360
- fn visit_path ( & mut self , path : & ' v Path , _id : HirId ) {
360
+ fn visit_path ( & mut self , path : & ' v Path < ' v > , _id : HirId ) {
361
361
walk_path ( self , path)
362
362
}
363
- fn visit_path_segment ( & mut self , path_span : Span , path_segment : & ' v PathSegment ) {
363
+ fn visit_path_segment ( & mut self , path_span : Span , path_segment : & ' v PathSegment < ' v > ) {
364
364
walk_path_segment ( self , path_span, path_segment)
365
365
}
366
- fn visit_generic_args ( & mut self , path_span : Span , generic_args : & ' v GenericArgs ) {
366
+ fn visit_generic_args ( & mut self , path_span : Span , generic_args : & ' v GenericArgs < ' v > ) {
367
367
walk_generic_args ( self , path_span, generic_args)
368
368
}
369
- fn visit_assoc_type_binding ( & mut self , type_binding : & ' v TypeBinding ) {
369
+ fn visit_assoc_type_binding ( & mut self , type_binding : & ' v TypeBinding < ' v > ) {
370
370
walk_assoc_type_binding ( self , type_binding)
371
371
}
372
372
fn visit_attribute ( & mut self , _attr : & ' v Attribute ) { }
373
373
fn visit_macro_def ( & mut self , macro_def : & ' v MacroDef < ' v > ) {
374
374
walk_macro_def ( self , macro_def)
375
375
}
376
- fn visit_vis ( & mut self , vis : & ' v Visibility ) {
376
+ fn visit_vis ( & mut self , vis : & ' v Visibility < ' v > ) {
377
377
walk_vis ( self , vis)
378
378
}
379
379
fn visit_associated_item_kind ( & mut self , kind : & ' v AssocItemKind ) {
@@ -445,7 +445,7 @@ pub fn walk_lifetime<'v, V: Visitor<'v>>(visitor: &mut V, lifetime: &'v Lifetime
445
445
446
446
pub fn walk_poly_trait_ref < ' v , V > (
447
447
visitor : & mut V ,
448
- trait_ref : & ' v PolyTraitRef ,
448
+ trait_ref : & ' v PolyTraitRef < ' v > ,
449
449
_modifier : TraitBoundModifier ,
450
450
) where
451
451
V : Visitor < ' v > ,
@@ -454,7 +454,7 @@ pub fn walk_poly_trait_ref<'v, V>(
454
454
visitor. visit_trait_ref ( & trait_ref. trait_ref ) ;
455
455
}
456
456
457
- pub fn walk_trait_ref < ' v , V > ( visitor : & mut V , trait_ref : & ' v TraitRef )
457
+ pub fn walk_trait_ref < ' v , V > ( visitor : & mut V , trait_ref : & ' v TraitRef < ' v > )
458
458
where
459
459
V : Visitor < ' v > ,
460
460
{
@@ -553,15 +553,15 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item<'v>) {
553
553
walk_list ! ( visitor, visit_attribute, item. attrs) ;
554
554
}
555
555
556
- pub fn walk_use < ' v , V : Visitor < ' v > > ( visitor : & mut V , path : & ' v Path , hir_id : HirId ) {
556
+ pub fn walk_use < ' v , V : Visitor < ' v > > ( visitor : & mut V , path : & ' v Path < ' v > , hir_id : HirId ) {
557
557
visitor. visit_id ( hir_id) ;
558
558
visitor. visit_path ( path, hir_id) ;
559
559
}
560
560
561
561
pub fn walk_enum_def < ' v , V : Visitor < ' v > > (
562
562
visitor : & mut V ,
563
563
enum_definition : & ' v EnumDef < ' v > ,
564
- generics : & ' v Generics ,
564
+ generics : & ' v Generics < ' v > ,
565
565
item_id : HirId ,
566
566
) {
567
567
visitor. visit_id ( item_id) ;
@@ -571,7 +571,7 @@ pub fn walk_enum_def<'v, V: Visitor<'v>>(
571
571
pub fn walk_variant < ' v , V : Visitor < ' v > > (
572
572
visitor : & mut V ,
573
573
variant : & ' v Variant < ' v > ,
574
- generics : & ' v Generics ,
574
+ generics : & ' v Generics < ' v > ,
575
575
parent_item_id : HirId ,
576
576
) {
577
577
visitor. visit_ident ( variant. ident ) ;
@@ -587,7 +587,7 @@ pub fn walk_variant<'v, V: Visitor<'v>>(
587
587
walk_list ! ( visitor, visit_attribute, variant. attrs) ;
588
588
}
589
589
590
- pub fn walk_ty < ' v , V : Visitor < ' v > > ( visitor : & mut V , typ : & ' v Ty ) {
590
+ pub fn walk_ty < ' v , V : Visitor < ' v > > ( visitor : & mut V , typ : & ' v Ty < ' v > ) {
591
591
visitor. visit_id ( typ. hir_id ) ;
592
592
593
593
match typ. kind {
@@ -627,7 +627,12 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty) {
627
627
}
628
628
}
629
629
630
- pub fn walk_qpath < ' v , V : Visitor < ' v > > ( visitor : & mut V , qpath : & ' v QPath , id : HirId , span : Span ) {
630
+ pub fn walk_qpath < ' v , V : Visitor < ' v > > (
631
+ visitor : & mut V ,
632
+ qpath : & ' v QPath < ' v > ,
633
+ id : HirId ,
634
+ span : Span ,
635
+ ) {
631
636
match * qpath {
632
637
QPath :: Resolved ( ref maybe_qself, ref path) => {
633
638
if let Some ( ref qself) = * maybe_qself {
@@ -642,7 +647,7 @@ pub fn walk_qpath<'v, V: Visitor<'v>>(visitor: &mut V, qpath: &'v QPath, id: Hir
642
647
}
643
648
}
644
649
645
- pub fn walk_path < ' v , V : Visitor < ' v > > ( visitor : & mut V , path : & ' v Path ) {
650
+ pub fn walk_path < ' v , V : Visitor < ' v > > ( visitor : & mut V , path : & ' v Path < ' v > ) {
646
651
for segment in & path. segments {
647
652
visitor. visit_path_segment ( path. span , segment) ;
648
653
}
@@ -651,7 +656,7 @@ pub fn walk_path<'v, V: Visitor<'v>>(visitor: &mut V, path: &'v Path) {
651
656
pub fn walk_path_segment < ' v , V : Visitor < ' v > > (
652
657
visitor : & mut V ,
653
658
path_span : Span ,
654
- segment : & ' v PathSegment ,
659
+ segment : & ' v PathSegment < ' v > ,
655
660
) {
656
661
visitor. visit_ident ( segment. ident ) ;
657
662
if let Some ( id) = segment. hir_id {
@@ -665,13 +670,16 @@ pub fn walk_path_segment<'v, V: Visitor<'v>>(
665
670
pub fn walk_generic_args < ' v , V : Visitor < ' v > > (
666
671
visitor : & mut V ,
667
672
_path_span : Span ,
668
- generic_args : & ' v GenericArgs ,
673
+ generic_args : & ' v GenericArgs < ' v > ,
669
674
) {
670
675
walk_list ! ( visitor, visit_generic_arg, & generic_args. args) ;
671
676
walk_list ! ( visitor, visit_assoc_type_binding, & generic_args. bindings) ;
672
677
}
673
678
674
- pub fn walk_assoc_type_binding < ' v , V : Visitor < ' v > > ( visitor : & mut V , type_binding : & ' v TypeBinding ) {
679
+ pub fn walk_assoc_type_binding < ' v , V : Visitor < ' v > > (
680
+ visitor : & mut V ,
681
+ type_binding : & ' v TypeBinding < ' v > ,
682
+ ) {
675
683
visitor. visit_id ( type_binding. hir_id ) ;
676
684
visitor. visit_ident ( type_binding. ident ) ;
677
685
match type_binding. kind {
@@ -747,7 +755,7 @@ pub fn walk_foreign_item<'v, V: Visitor<'v>>(visitor: &mut V, foreign_item: &'v
747
755
walk_list ! ( visitor, visit_attribute, foreign_item. attrs) ;
748
756
}
749
757
750
- pub fn walk_param_bound < ' v , V : Visitor < ' v > > ( visitor : & mut V , bound : & ' v GenericBound ) {
758
+ pub fn walk_param_bound < ' v , V : Visitor < ' v > > ( visitor : & mut V , bound : & ' v GenericBound < ' v > ) {
751
759
match * bound {
752
760
GenericBound :: Trait ( ref typ, modifier) => {
753
761
visitor. visit_poly_trait_ref ( typ, modifier) ;
@@ -756,7 +764,7 @@ pub fn walk_param_bound<'v, V: Visitor<'v>>(visitor: &mut V, bound: &'v GenericB
756
764
}
757
765
}
758
766
759
- pub fn walk_generic_param < ' v , V : Visitor < ' v > > ( visitor : & mut V , param : & ' v GenericParam ) {
767
+ pub fn walk_generic_param < ' v , V : Visitor < ' v > > ( visitor : & mut V , param : & ' v GenericParam < ' v > ) {
760
768
visitor. visit_id ( param. hir_id ) ;
761
769
walk_list ! ( visitor, visit_attribute, & param. attrs) ;
762
770
match param. name {
@@ -771,12 +779,15 @@ pub fn walk_generic_param<'v, V: Visitor<'v>>(visitor: &mut V, param: &'v Generi
771
779
walk_list ! ( visitor, visit_param_bound, & param. bounds) ;
772
780
}
773
781
774
- pub fn walk_generics < ' v , V : Visitor < ' v > > ( visitor : & mut V , generics : & ' v Generics ) {
782
+ pub fn walk_generics < ' v , V : Visitor < ' v > > ( visitor : & mut V , generics : & ' v Generics < ' v > ) {
775
783
walk_list ! ( visitor, visit_generic_param, & generics. params) ;
776
784
walk_list ! ( visitor, visit_where_predicate, & generics. where_clause. predicates) ;
777
785
}
778
786
779
- pub fn walk_where_predicate < ' v , V : Visitor < ' v > > ( visitor : & mut V , predicate : & ' v WherePredicate ) {
787
+ pub fn walk_where_predicate < ' v , V : Visitor < ' v > > (
788
+ visitor : & mut V ,
789
+ predicate : & ' v WherePredicate < ' v > ,
790
+ ) {
780
791
match predicate {
781
792
& WherePredicate :: BoundPredicate ( WhereBoundPredicate {
782
793
ref bounded_ty,
@@ -804,13 +815,13 @@ pub fn walk_where_predicate<'v, V: Visitor<'v>>(visitor: &mut V, predicate: &'v
804
815
}
805
816
}
806
817
807
- pub fn walk_fn_ret_ty < ' v , V : Visitor < ' v > > ( visitor : & mut V , ret_ty : & ' v FunctionRetTy ) {
818
+ pub fn walk_fn_ret_ty < ' v , V : Visitor < ' v > > ( visitor : & mut V , ret_ty : & ' v FunctionRetTy < ' v > ) {
808
819
if let Return ( ref output_ty) = * ret_ty {
809
820
visitor. visit_ty ( output_ty)
810
821
}
811
822
}
812
823
813
- pub fn walk_fn_decl < ' v , V : Visitor < ' v > > ( visitor : & mut V , function_declaration : & ' v FnDecl ) {
824
+ pub fn walk_fn_decl < ' v , V : Visitor < ' v > > ( visitor : & mut V , function_declaration : & ' v FnDecl < ' v > ) {
814
825
for ty in & function_declaration. inputs {
815
826
visitor. visit_ty ( ty)
816
827
}
@@ -829,7 +840,7 @@ pub fn walk_fn_kind<'v, V: Visitor<'v>>(visitor: &mut V, function_kind: FnKind<'
829
840
pub fn walk_fn < ' v , V : Visitor < ' v > > (
830
841
visitor : & mut V ,
831
842
function_kind : FnKind < ' v > ,
832
- function_declaration : & ' v FnDecl ,
843
+ function_declaration : & ' v FnDecl < ' v > ,
833
844
body_id : BodyId ,
834
845
_span : Span ,
835
846
id : HirId ,
@@ -927,7 +938,7 @@ pub fn walk_impl_item<'v, V: Visitor<'v>>(visitor: &mut V, impl_item: &'v ImplIt
927
938
}
928
939
}
929
940
930
- pub fn walk_impl_item_ref < ' v , V : Visitor < ' v > > ( visitor : & mut V , impl_item_ref : & ' v ImplItemRef ) {
941
+ pub fn walk_impl_item_ref < ' v , V : Visitor < ' v > > ( visitor : & mut V , impl_item_ref : & ' v ImplItemRef < ' v > ) {
931
942
// N.B., deliberately force a compilation error if/when new fields are added.
932
943
let ImplItemRef { id, ident, ref kind, span : _, ref vis, ref defaultness } = * impl_item_ref;
933
944
visitor. visit_nested_impl_item ( id) ;
@@ -1099,7 +1110,7 @@ pub fn walk_arm<'v, V: Visitor<'v>>(visitor: &mut V, arm: &'v Arm<'v>) {
1099
1110
walk_list ! ( visitor, visit_attribute, arm. attrs) ;
1100
1111
}
1101
1112
1102
- pub fn walk_vis < ' v , V : Visitor < ' v > > ( visitor : & mut V , vis : & ' v Visibility ) {
1113
+ pub fn walk_vis < ' v , V : Visitor < ' v > > ( visitor : & mut V , vis : & ' v Visibility < ' v > ) {
1103
1114
if let VisibilityKind :: Restricted { ref path, hir_id } = vis. node {
1104
1115
visitor. visit_id ( hir_id) ;
1105
1116
visitor. visit_path ( path, hir_id)
0 commit comments