mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
resolve: Do not create unnecessary ParentScope when building external modules
This commit is contained in:
@@ -251,16 +251,15 @@ pub(crate) fn build_reduced_graph(
|
||||
pub(crate) fn build_reduced_graph_external(&self, module: ExternModule<'ra>) {
|
||||
let def_id = module.def_id();
|
||||
let children = self.tcx.module_children(def_id);
|
||||
let parent_scope = ParentScope::module(module.to_module(), self.arenas);
|
||||
for (i, child) in children.iter().enumerate() {
|
||||
self.build_reduced_graph_for_external_crate_res(child, parent_scope, i, None)
|
||||
self.build_reduced_graph_for_external_crate_res(child, module, i, None)
|
||||
}
|
||||
for (i, child) in
|
||||
self.cstore().ambig_module_children_untracked(self.tcx, def_id).enumerate()
|
||||
{
|
||||
self.build_reduced_graph_for_external_crate_res(
|
||||
&child.main,
|
||||
parent_scope,
|
||||
module,
|
||||
children.len() + i,
|
||||
Some(&child.second),
|
||||
)
|
||||
@@ -271,11 +270,10 @@ pub(crate) fn build_reduced_graph_external(&self, module: ExternModule<'ra>) {
|
||||
fn build_reduced_graph_for_external_crate_res(
|
||||
&self,
|
||||
child: &ModChild,
|
||||
parent_scope: ParentScope<'ra>,
|
||||
parent: ExternModule<'ra>,
|
||||
child_index: usize,
|
||||
ambig_child: Option<&ModChild>,
|
||||
) {
|
||||
let parent = parent_scope.module.expect_extern();
|
||||
let child_span = |this: &Self, reexport_chain: &[Reexport], res: def::Res<_>| {
|
||||
this.def_span(
|
||||
reexport_chain
|
||||
@@ -288,7 +286,7 @@ fn build_reduced_graph_for_external_crate_res(
|
||||
let ident = IdentKey::new(orig_ident);
|
||||
let span = child_span(self, reexport_chain, res);
|
||||
let res = res.expect_non_local();
|
||||
let expansion = parent_scope.expansion;
|
||||
let expansion = LocalExpnId::ROOT;
|
||||
let ambig = ambig_child.map(|ambig_child| {
|
||||
let ModChild { ident: _, res, vis, ref reexport_chain } = *ambig_child;
|
||||
let span = child_span(self, reexport_chain, res);
|
||||
|
||||
Reference in New Issue
Block a user