@@ -112,11 +112,14 @@ pub enum LifetimeCtxt {
112
112
GenericArg ,
113
113
}
114
114
115
- pub trait WalkItemKind : Sized {
115
+ pub trait WalkItemKind {
116
116
type Ctxt ;
117
117
fn walk < ' a , V : Visitor < ' a > > (
118
118
& ' a self ,
119
- item : & ' a Item < Self > ,
119
+ span : Span ,
120
+ id : NodeId ,
121
+ ident : & ' a Ident ,
122
+ visibility : & ' a Visibility ,
120
123
ctxt : Self :: Ctxt ,
121
124
visitor : & mut V ,
122
125
) -> V :: Result ;
@@ -341,14 +344,16 @@ impl WalkItemKind for ItemKind {
341
344
type Ctxt = ( ) ;
342
345
fn walk < ' a , V : Visitor < ' a > > (
343
346
& ' a self ,
344
- item : & ' a Item < Self > ,
347
+ span : Span ,
348
+ id : NodeId ,
349
+ ident : & ' a Ident ,
350
+ vis : & ' a Visibility ,
345
351
_ctxt : Self :: Ctxt ,
346
352
visitor : & mut V ,
347
353
) -> V :: Result {
348
- let Item { id, span, vis, ident, .. } = item;
349
354
match self {
350
355
ItemKind :: ExternCrate ( _rename) => { }
351
- ItemKind :: Use ( use_tree) => try_visit ! ( visitor. visit_use_tree( use_tree, * id, false ) ) ,
356
+ ItemKind :: Use ( use_tree) => try_visit ! ( visitor. visit_use_tree( use_tree, id, false ) ) ,
352
357
ItemKind :: Static ( box StaticItem { ty, safety : _, mutability : _, expr } ) => {
353
358
try_visit ! ( visitor. visit_ty( ty) ) ;
354
359
visit_opt ! ( visitor, visit_expr, expr) ;
@@ -360,7 +365,7 @@ impl WalkItemKind for ItemKind {
360
365
}
361
366
ItemKind :: Fn ( box Fn { defaultness : _, generics, sig, body } ) => {
362
367
let kind = FnKind :: Fn ( FnCtxt :: Free , ident, sig, vis, generics, body) ;
363
- try_visit ! ( visitor. visit_fn( kind, * span, * id) ) ;
368
+ try_visit ! ( visitor. visit_fn( kind, span, id) ) ;
364
369
}
365
370
ItemKind :: Mod ( _unsafety, mod_kind) => match mod_kind {
366
371
ModKind :: Loaded ( items, _inline, _inner_span) => {
@@ -417,7 +422,7 @@ impl WalkItemKind for ItemKind {
417
422
walk_list ! ( visitor, visit_param_bound, bounds, BoundKind :: Bound ) ;
418
423
}
419
424
ItemKind :: MacCall ( mac) => try_visit ! ( visitor. visit_mac_call( mac) ) ,
420
- ItemKind :: MacroDef ( ts) => try_visit ! ( visitor. visit_mac_def( ts, * id) ) ,
425
+ ItemKind :: MacroDef ( ts) => try_visit ! ( visitor. visit_mac_def( ts, id) ) ,
421
426
ItemKind :: Delegation ( box Delegation {
422
427
id,
423
428
qself,
@@ -433,7 +438,7 @@ impl WalkItemKind for ItemKind {
433
438
}
434
439
ItemKind :: DelegationMac ( box DelegationMac { qself, prefix, suffixes, body } ) => {
435
440
try_visit ! ( walk_qself( visitor, qself) ) ;
436
- try_visit ! ( visitor. visit_path( prefix, * id) ) ;
441
+ try_visit ! ( visitor. visit_path( prefix, id) ) ;
437
442
if let Some ( suffixes) = suffixes {
438
443
for ( ident, rename) in suffixes {
439
444
visitor. visit_ident ( ident) ;
@@ -686,19 +691,21 @@ impl WalkItemKind for ForeignItemKind {
686
691
type Ctxt = ( ) ;
687
692
fn walk < ' a , V : Visitor < ' a > > (
688
693
& ' a self ,
689
- item : & ' a Item < Self > ,
694
+ span : Span ,
695
+ id : NodeId ,
696
+ ident : & ' a Ident ,
697
+ vis : & ' a Visibility ,
690
698
_ctxt : Self :: Ctxt ,
691
699
visitor : & mut V ,
692
700
) -> V :: Result {
693
- let Item { id, span, ident, vis, .. } = item;
694
701
match self {
695
702
ForeignItemKind :: Static ( box StaticItem { ty, mutability : _, expr, safety : _ } ) => {
696
703
try_visit ! ( visitor. visit_ty( ty) ) ;
697
704
visit_opt ! ( visitor, visit_expr, expr) ;
698
705
}
699
706
ForeignItemKind :: Fn ( box Fn { defaultness : _, generics, sig, body } ) => {
700
707
let kind = FnKind :: Fn ( FnCtxt :: Foreign , ident, sig, vis, generics, body) ;
701
- try_visit ! ( visitor. visit_fn( kind, * span, * id) ) ;
708
+ try_visit ! ( visitor. visit_fn( kind, span, id) ) ;
702
709
}
703
710
ForeignItemKind :: TyAlias ( box TyAlias {
704
711
generics,
@@ -850,11 +857,13 @@ impl WalkItemKind for AssocItemKind {
850
857
type Ctxt = AssocCtxt ;
851
858
fn walk < ' a , V : Visitor < ' a > > (
852
859
& ' a self ,
853
- item : & ' a Item < Self > ,
860
+ span : Span ,
861
+ id : NodeId ,
862
+ ident : & ' a Ident ,
863
+ vis : & ' a Visibility ,
854
864
ctxt : Self :: Ctxt ,
855
865
visitor : & mut V ,
856
866
) -> V :: Result {
857
- let Item { id, span, ident, vis, .. } = item;
858
867
match self {
859
868
AssocItemKind :: Const ( box ConstItem { defaultness : _, generics, ty, expr } ) => {
860
869
try_visit ! ( visitor. visit_generics( generics) ) ;
@@ -863,7 +872,7 @@ impl WalkItemKind for AssocItemKind {
863
872
}
864
873
AssocItemKind :: Fn ( box Fn { defaultness : _, generics, sig, body } ) => {
865
874
let kind = FnKind :: Fn ( FnCtxt :: Assoc ( ctxt) , ident, sig, vis, generics, body) ;
866
- try_visit ! ( visitor. visit_fn( kind, * span, * id) ) ;
875
+ try_visit ! ( visitor. visit_fn( kind, span, id) ) ;
867
876
}
868
877
AssocItemKind :: Type ( box TyAlias {
869
878
generics,
@@ -894,7 +903,7 @@ impl WalkItemKind for AssocItemKind {
894
903
}
895
904
AssocItemKind :: DelegationMac ( box DelegationMac { qself, prefix, suffixes, body } ) => {
896
905
try_visit ! ( walk_qself( visitor, qself) ) ;
897
- try_visit ! ( visitor. visit_path( prefix, * id) ) ;
906
+ try_visit ! ( visitor. visit_path( prefix, id) ) ;
898
907
if let Some ( suffixes) = suffixes {
899
908
for ( ident, rename) in suffixes {
900
909
visitor. visit_ident ( ident) ;
@@ -915,11 +924,11 @@ pub fn walk_assoc_item<'a, V: Visitor<'a>, K: WalkItemKind>(
915
924
item : & ' a Item < K > ,
916
925
ctxt : K :: Ctxt ,
917
926
) -> V :: Result {
918
- let Item { id : _ , span : _ , ident, vis, attrs, kind, tokens : _ } = item;
927
+ let Item { id, span, ident, vis, attrs, kind, tokens : _ } = item;
919
928
walk_list ! ( visitor, visit_attribute, attrs) ;
920
929
try_visit ! ( visitor. visit_vis( vis) ) ;
921
930
try_visit ! ( visitor. visit_ident( ident) ) ;
922
- try_visit ! ( kind. walk( item , ctxt, visitor) ) ;
931
+ try_visit ! ( kind. walk( * span , * id , ident , vis , ctxt, visitor) ) ;
923
932
V :: Result :: output ( )
924
933
}
925
934
0 commit comments