@@ -647,8 +647,6 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
647647 self . r . define ( parent, ident, TypeNS , imported_binding) ;
648648 }
649649
650- ItemKind :: GlobalAsm ( ..) => { }
651-
652650 ItemKind :: Mod ( ..) if ident. name == kw:: Invalid => { } // Crate root
653651
654652 ItemKind :: Mod ( ..) => {
@@ -667,9 +665,6 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
667665 self . parent_scope . module = module;
668666 }
669667
670- // Handled in `rustc_metadata::{native_libs,link_args}`
671- ItemKind :: ForeignMod ( ..) => { }
672-
673668 // These items live in the value namespace.
674669 ItemKind :: Static ( ..) => {
675670 let res = Res :: Def ( DefKind :: Static , self . r . definitions . local_def_id ( item. id ) ) ;
@@ -765,12 +760,6 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
765760 self . insert_field_names_local ( def_id, vdata) ;
766761 }
767762
768- ItemKind :: Impl ( .., ref impl_items) => {
769- for impl_item in impl_items {
770- self . resolve_visibility ( & impl_item. vis ) ;
771- }
772- }
773-
774763 ItemKind :: Trait ( ..) => {
775764 let def_id = self . r . definitions . local_def_id ( item. id ) ;
776765
@@ -785,6 +774,9 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
785774 self . parent_scope . module = module;
786775 }
787776
777+ // These items do not add names to modules.
778+ ItemKind :: Impl ( ..) | ItemKind :: ForeignMod ( ..) | ItemKind :: GlobalAsm ( ..) => { }
779+
788780 ItemKind :: MacroDef ( ..) | ItemKind :: Mac ( _) => unreachable ! ( ) ,
789781 }
790782 }
@@ -1118,7 +1110,6 @@ macro_rules! method {
11181110}
11191111
11201112impl < ' a , ' b > Visitor < ' b > for BuildReducedGraphVisitor < ' a , ' b > {
1121- method ! ( visit_impl_item: ast:: ImplItem , ast:: ImplItemKind :: Macro , walk_impl_item) ;
11221113 method ! ( visit_expr: ast:: Expr , ast:: ExprKind :: Mac , walk_expr) ;
11231114 method ! ( visit_pat: ast:: Pat , ast:: PatKind :: Mac , walk_pat) ;
11241115 method ! ( visit_ty: ast:: Ty , ast:: TyKind :: Mac , walk_ty) ;
@@ -1202,6 +1193,15 @@ impl<'a, 'b> Visitor<'b> for BuildReducedGraphVisitor<'a, 'b> {
12021193 visit:: walk_trait_item ( self , item) ;
12031194 }
12041195
1196+ fn visit_impl_item ( & mut self , item : & ' b ast:: ImplItem ) {
1197+ if let ast:: ImplItemKind :: Macro ( ..) = item. kind {
1198+ self . visit_invoc ( item. id ) ;
1199+ } else {
1200+ self . resolve_visibility ( & item. vis ) ;
1201+ visit:: walk_impl_item ( self , item) ;
1202+ }
1203+ }
1204+
12051205 fn visit_token ( & mut self , t : Token ) {
12061206 if let token:: Interpolated ( nt) = t. kind {
12071207 if let token:: NtExpr ( ref expr) = * nt {
0 commit comments