@@ -267,6 +267,12 @@ pub trait Visitor<'v> : Sized {
267267 fn visit_vis ( & mut self , vis : & ' v Visibility ) {
268268 walk_vis ( self , vis)
269269 }
270+ fn visit_associated_item_kind ( & mut self , kind : & ' v AssociatedItemKind ) {
271+ walk_associated_item_kind ( self , kind) ;
272+ }
273+ fn visit_defaultness ( & mut self , defaultness : & ' v Defaultness ) {
274+ walk_defaultness ( self , defaultness) ;
275+ }
270276}
271277
272278pub fn walk_opt_name < ' v , V : Visitor < ' v > > ( visitor : & mut V , span : Span , opt_name : Option < Name > ) {
@@ -740,10 +746,14 @@ pub fn walk_trait_item<'v, V: Visitor<'v>>(visitor: &mut V, trait_item: &'v Trai
740746}
741747
742748pub fn walk_impl_item < ' v , V : Visitor < ' v > > ( visitor : & mut V , impl_item : & ' v ImplItem ) {
743- visitor. visit_vis ( & impl_item. vis ) ;
744- visitor. visit_name ( impl_item. span , impl_item. name ) ;
745- walk_list ! ( visitor, visit_attribute, & impl_item. attrs) ;
746- match impl_item. node {
749+ // NB: Deliberately force a compilation error if/when new fields are added.
750+ let ImplItem { id : _, name, ref vis, ref defaultness, ref attrs, ref node, span } = * impl_item;
751+
752+ visitor. visit_name ( span, name) ;
753+ visitor. visit_vis ( vis) ;
754+ visitor. visit_defaultness ( defaultness) ;
755+ walk_list ! ( visitor, visit_attribute, attrs) ;
756+ match * node {
747757 ImplItemKind :: Const ( ref ty, ref expr) => {
748758 visitor. visit_id ( impl_item. id ) ;
749759 visitor. visit_ty ( ty) ;
@@ -767,8 +777,13 @@ pub fn walk_impl_item<'v, V: Visitor<'v>>(visitor: &mut V, impl_item: &'v ImplIt
767777}
768778
769779pub fn walk_impl_item_ref < ' v , V : Visitor < ' v > > ( visitor : & mut V , impl_item_ref : & ' v ImplItemRef ) {
770- visitor. visit_nested_impl_item ( impl_item_ref. id ) ;
771- visitor. visit_name ( impl_item_ref. span , impl_item_ref. name ) ;
780+ // NB: Deliberately force a compilation error if/when new fields are added.
781+ let ImplItemRef { id, name, ref kind, span, ref vis, ref defaultness } = * impl_item_ref;
782+ visitor. visit_nested_impl_item ( id) ;
783+ visitor. visit_name ( span, name) ;
784+ visitor. visit_associated_item_kind ( kind) ;
785+ visitor. visit_vis ( vis) ;
786+ visitor. visit_defaultness ( defaultness) ;
772787}
773788
774789
@@ -941,6 +956,18 @@ pub fn walk_vis<'v, V: Visitor<'v>>(visitor: &mut V, vis: &'v Visibility) {
941956 }
942957}
943958
959+ pub fn walk_associated_item_kind < ' v , V : Visitor < ' v > > ( _: & mut V , _: & ' v AssociatedItemKind ) {
960+ // No visitable content here: this fn exists so you can call it if
961+ // the right thing to do, should content be added in the future,
962+ // would be to walk it.
963+ }
964+
965+ pub fn walk_defaultness < ' v , V : Visitor < ' v > > ( _: & mut V , _: & ' v Defaultness ) {
966+ // No visitable content here: this fn exists so you can call it if
967+ // the right thing to do, should content be added in the future,
968+ // would be to walk it.
969+ }
970+
944971#[ derive( Copy , Clone , RustcEncodable , RustcDecodable , Debug , PartialEq , Eq ) ]
945972pub struct IdRange {
946973 pub min : NodeId ,
0 commit comments