Skip to content

Commit 38c14f3

Browse files
committed
resolve: Do not create unnecessary ParentScope when building external modules
1 parent e22c616 commit 38c14f3

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

compiler/rustc_resolve/src/build_reduced_graph.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -251,16 +251,15 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
251251
pub(crate) fn build_reduced_graph_external(&self, module: ExternModule<'ra>) {
252252
let def_id = module.def_id();
253253
let children = self.tcx.module_children(def_id);
254-
let parent_scope = ParentScope::module(module.to_module(), self.arenas);
255254
for (i, child) in children.iter().enumerate() {
256-
self.build_reduced_graph_for_external_crate_res(child, parent_scope, i, None)
255+
self.build_reduced_graph_for_external_crate_res(child, module, i, None)
257256
}
258257
for (i, child) in
259258
self.cstore().ambig_module_children_untracked(self.tcx, def_id).enumerate()
260259
{
261260
self.build_reduced_graph_for_external_crate_res(
262261
&child.main,
263-
parent_scope,
262+
module,
264263
children.len() + i,
265264
Some(&child.second),
266265
)
@@ -271,11 +270,10 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
271270
fn build_reduced_graph_for_external_crate_res(
272271
&self,
273272
child: &ModChild,
274-
parent_scope: ParentScope<'ra>,
273+
parent: ExternModule<'ra>,
275274
child_index: usize,
276275
ambig_child: Option<&ModChild>,
277276
) {
278-
let parent = parent_scope.module.expect_extern();
279277
let child_span = |this: &Self, reexport_chain: &[Reexport], res: def::Res<_>| {
280278
this.def_span(
281279
reexport_chain
@@ -288,7 +286,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
288286
let ident = IdentKey::new(orig_ident);
289287
let span = child_span(self, reexport_chain, res);
290288
let res = res.expect_non_local();
291-
let expansion = parent_scope.expansion;
289+
let expansion = LocalExpnId::ROOT;
292290
let ambig = ambig_child.map(|ambig_child| {
293291
let ModChild { ident: _, res, vis, ref reexport_chain } = *ambig_child;
294292
let span = child_span(self, reexport_chain, res);

0 commit comments

Comments
 (0)