@@ -112,11 +112,14 @@ pub enum LifetimeCtxt {
112112 GenericArg ,
113113}
114114
115- pub trait WalkItemKind : Sized {
115+ pub trait WalkItemKind {
116116 type Ctxt ;
117117 fn walk < ' a , V : Visitor < ' a > > (
118118 & ' a self ,
119- item : & ' a Item < Self > ,
119+ span : Span ,
120+ id : NodeId ,
121+ ident : & ' a Ident ,
122+ visibility : & ' a Visibility ,
120123 ctxt : Self :: Ctxt ,
121124 visitor : & mut V ,
122125 ) -> V :: Result ;
@@ -341,14 +344,16 @@ impl WalkItemKind for ItemKind {
341344 type Ctxt = ( ) ;
342345 fn walk < ' a , V : Visitor < ' a > > (
343346 & ' a self ,
344- item : & ' a Item < Self > ,
347+ span : Span ,
348+ id : NodeId ,
349+ ident : & ' a Ident ,
350+ vis : & ' a Visibility ,
345351 _ctxt : Self :: Ctxt ,
346352 visitor : & mut V ,
347353 ) -> V :: Result {
348- let Item { id, span, vis, ident, .. } = item;
349354 match self {
350355 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 ) ) ,
352357 ItemKind :: Static ( box StaticItem { ty, safety : _, mutability : _, expr } ) => {
353358 try_visit ! ( visitor. visit_ty( ty) ) ;
354359 visit_opt ! ( visitor, visit_expr, expr) ;
@@ -360,7 +365,7 @@ impl WalkItemKind for ItemKind {
360365 }
361366 ItemKind :: Fn ( box Fn { defaultness : _, generics, sig, body } ) => {
362367 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) ) ;
364369 }
365370 ItemKind :: Mod ( _unsafety, mod_kind) => match mod_kind {
366371 ModKind :: Loaded ( items, _inline, _inner_span) => {
@@ -417,7 +422,7 @@ impl WalkItemKind for ItemKind {
417422 walk_list ! ( visitor, visit_param_bound, bounds, BoundKind :: Bound ) ;
418423 }
419424 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) ) ,
421426 ItemKind :: Delegation ( box Delegation {
422427 id,
423428 qself,
@@ -433,7 +438,7 @@ impl WalkItemKind for ItemKind {
433438 }
434439 ItemKind :: DelegationMac ( box DelegationMac { qself, prefix, suffixes, body } ) => {
435440 try_visit ! ( walk_qself( visitor, qself) ) ;
436- try_visit ! ( visitor. visit_path( prefix, * id) ) ;
441+ try_visit ! ( visitor. visit_path( prefix, id) ) ;
437442 if let Some ( suffixes) = suffixes {
438443 for ( ident, rename) in suffixes {
439444 visitor. visit_ident ( ident) ;
@@ -686,19 +691,21 @@ impl WalkItemKind for ForeignItemKind {
686691 type Ctxt = ( ) ;
687692 fn walk < ' a , V : Visitor < ' a > > (
688693 & ' a self ,
689- item : & ' a Item < Self > ,
694+ span : Span ,
695+ id : NodeId ,
696+ ident : & ' a Ident ,
697+ vis : & ' a Visibility ,
690698 _ctxt : Self :: Ctxt ,
691699 visitor : & mut V ,
692700 ) -> V :: Result {
693- let Item { id, span, ident, vis, .. } = item;
694701 match self {
695702 ForeignItemKind :: Static ( box StaticItem { ty, mutability : _, expr, safety : _ } ) => {
696703 try_visit ! ( visitor. visit_ty( ty) ) ;
697704 visit_opt ! ( visitor, visit_expr, expr) ;
698705 }
699706 ForeignItemKind :: Fn ( box Fn { defaultness : _, generics, sig, body } ) => {
700707 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) ) ;
702709 }
703710 ForeignItemKind :: TyAlias ( box TyAlias {
704711 generics,
@@ -850,11 +857,13 @@ impl WalkItemKind for AssocItemKind {
850857 type Ctxt = AssocCtxt ;
851858 fn walk < ' a , V : Visitor < ' a > > (
852859 & ' a self ,
853- item : & ' a Item < Self > ,
860+ span : Span ,
861+ id : NodeId ,
862+ ident : & ' a Ident ,
863+ vis : & ' a Visibility ,
854864 ctxt : Self :: Ctxt ,
855865 visitor : & mut V ,
856866 ) -> V :: Result {
857- let Item { id, span, ident, vis, .. } = item;
858867 match self {
859868 AssocItemKind :: Const ( box ConstItem { defaultness : _, generics, ty, expr } ) => {
860869 try_visit ! ( visitor. visit_generics( generics) ) ;
@@ -863,7 +872,7 @@ impl WalkItemKind for AssocItemKind {
863872 }
864873 AssocItemKind :: Fn ( box Fn { defaultness : _, generics, sig, body } ) => {
865874 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) ) ;
867876 }
868877 AssocItemKind :: Type ( box TyAlias {
869878 generics,
@@ -894,7 +903,7 @@ impl WalkItemKind for AssocItemKind {
894903 }
895904 AssocItemKind :: DelegationMac ( box DelegationMac { qself, prefix, suffixes, body } ) => {
896905 try_visit ! ( walk_qself( visitor, qself) ) ;
897- try_visit ! ( visitor. visit_path( prefix, * id) ) ;
906+ try_visit ! ( visitor. visit_path( prefix, id) ) ;
898907 if let Some ( suffixes) = suffixes {
899908 for ( ident, rename) in suffixes {
900909 visitor. visit_ident ( ident) ;
@@ -915,11 +924,11 @@ pub fn walk_assoc_item<'a, V: Visitor<'a>, K: WalkItemKind>(
915924 item : & ' a Item < K > ,
916925 ctxt : K :: Ctxt ,
917926) -> V :: Result {
918- let Item { id : _ , span : _ , ident, vis, attrs, kind, tokens : _ } = item;
927+ let Item { id, span, ident, vis, attrs, kind, tokens : _ } = item;
919928 walk_list ! ( visitor, visit_attribute, attrs) ;
920929 try_visit ! ( visitor. visit_vis( vis) ) ;
921930 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) ) ;
923932 V :: Result :: output ( )
924933}
925934
0 commit comments