diff --git a/compiler/rustc_resolve/src/build_reduced_graph.rs b/compiler/rustc_resolve/src/build_reduced_graph.rs index 9ba4d057e736..420fcfb9e6cb 100644 --- a/compiler/rustc_resolve/src/build_reduced_graph.rs +++ b/compiler/rustc_resolve/src/build_reduced_graph.rs @@ -1517,12 +1517,7 @@ fn visit_field_def(&mut self, sf: &'a ast::FieldDef) { // Constructs the reduced graph for one variant. Variants exist in the // type and value namespaces. - fn visit_variant(&mut self, variant: &'a ast::Variant) { - if variant.is_placeholder { - self.visit_invoc_in_module(variant.id); - return; - } - + pub(crate) fn brg_visit_variant(&mut self, variant: &'a ast::Variant) { let parent = self.parent_scope.module.expect_local(); let expn_id = self.parent_scope.expansion; let ident = variant.ident; diff --git a/compiler/rustc_resolve/src/def_collector.rs b/compiler/rustc_resolve/src/def_collector.rs index 67ec610462b7..4bcd974dc276 100644 --- a/compiler/rustc_resolve/src/def_collector.rs +++ b/compiler/rustc_resolve/src/def_collector.rs @@ -312,7 +312,9 @@ fn visit_foreign_item(&mut self, fi: &'a ForeignItem) { fn visit_variant(&mut self, v: &'a Variant) { if v.is_placeholder { - return self.visit_macro_invoc(v.id); + self.visit_macro_invoc(v.id); + self.visit_invoc_in_module(v.id); + return; } let def = self.create_def(v.id, Some(v.ident.name), DefKind::Variant, v.span); self.with_parent(def, |this| { @@ -324,7 +326,7 @@ fn visit_variant(&mut self, v: &'a Variant) { v.span, ); } - visit::walk_variant(this, v) + this.brg_visit_variant(v); }); }