Rollup merge of #124341 - petrochenkov:nomacvisit, r=compiler-errors
resolve: Remove two cases of misleading macro call visiting Macro calls are ephemeral, they should not add anything to the definition tree, even if their AST could contains something with identity. Thankfully, macro call AST cannot contain anything like that, so these walks are just noops. In majority of other places in def_collector / build_reduced_graph they are already not visited. (Also, a minor match reformatting is included.)
This commit is contained in:
commit
645a4d34fb
2 changed files with 3 additions and 12 deletions
|
@ -1304,11 +1304,7 @@ impl<'a, 'b, 'tcx> Visitor<'b> for BuildReducedGraphVisitor<'a, 'b, 'tcx> {
|
|||
visit::walk_item(self, item);
|
||||
macro_rules_scope
|
||||
}
|
||||
ItemKind::MacCall(..) => {
|
||||
let macro_rules_scope = self.visit_invoc_in_module(item.id);
|
||||
visit::walk_item(self, item);
|
||||
macro_rules_scope
|
||||
}
|
||||
ItemKind::MacCall(..) => self.visit_invoc_in_module(item.id),
|
||||
_ => {
|
||||
let orig_macro_rules_scope = self.parent_scope.macro_rules;
|
||||
self.build_reduced_graph_for_item(item);
|
||||
|
|
|
@ -136,14 +136,9 @@ impl<'a, 'b, 'tcx> visit::Visitor<'a> for DefCollector<'a, 'b, 'tcx> {
|
|||
opt_macro_data = Some(macro_data);
|
||||
DefKind::Macro(macro_kind)
|
||||
}
|
||||
ItemKind::MacCall(..) => {
|
||||
visit::walk_item(self, i);
|
||||
return self.visit_macro_invoc(i.id);
|
||||
}
|
||||
ItemKind::GlobalAsm(..) => DefKind::GlobalAsm,
|
||||
ItemKind::Use(..) => {
|
||||
return visit::walk_item(self, i);
|
||||
}
|
||||
ItemKind::Use(..) => return visit::walk_item(self, i),
|
||||
ItemKind::MacCall(..) => return self.visit_macro_invoc(i.id),
|
||||
};
|
||||
let def_id = self.create_def(i.id, i.ident.name, def_kind, i.span);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue