expand: Turn ast::Crate
into a first class expansion target
And stop creating a fake `mod` item for the crate root when expanding a crate.
This commit is contained in:
parent
4919988fe1
commit
141c6cc78e
20 changed files with 203 additions and 159 deletions
|
@ -651,11 +651,6 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
|
|||
|
||||
/// Constructs the reduced graph for one item.
|
||||
fn build_reduced_graph_for_item(&mut self, item: &'b Item) {
|
||||
if matches!(item.kind, ItemKind::Mod(..)) && item.ident.name == kw::Empty {
|
||||
// Fake crate root item from expand.
|
||||
return;
|
||||
}
|
||||
|
||||
let parent_scope = &self.parent_scope;
|
||||
let parent = parent_scope.module;
|
||||
let expansion = parent_scope.expansion;
|
||||
|
@ -1499,4 +1494,13 @@ impl<'a, 'b> Visitor<'b> for BuildReducedGraphVisitor<'a, 'b> {
|
|||
|
||||
visit::walk_variant(self, variant);
|
||||
}
|
||||
|
||||
fn visit_crate(&mut self, krate: &'b ast::Crate) {
|
||||
if let Some(id) = krate.is_placeholder {
|
||||
self.visit_invoc_in_module(id);
|
||||
} else {
|
||||
visit::walk_crate(self, krate);
|
||||
self.contains_macro_use(&krate.attrs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue