Skip to content

Commit 6fc4456

Browse files
committed
resolve: Do not create unnecessary ParentScope when building external modules
1 parent 14196db commit 6fc4456

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
@@ -250,16 +250,15 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
250250
pub(crate) fn build_reduced_graph_external(&self, module: Module<'ra>) {
251251
let def_id = module.def_id();
252252
let children = self.tcx.module_children(def_id);
253-
let parent_scope = ParentScope::module(module, self.arenas);
254253
for (i, child) in children.iter().enumerate() {
255-
self.build_reduced_graph_for_external_crate_res(child, parent_scope, i, None)
254+
self.build_reduced_graph_for_external_crate_res(child, module, i, None)
256255
}
257256
for (i, child) in
258257
self.cstore().ambig_module_children_untracked(self.tcx, def_id).enumerate()
259258
{
260259
self.build_reduced_graph_for_external_crate_res(
261260
&child.main,
262-
parent_scope,
261+
module,
263262
children.len() + i,
264263
Some(&child.second),
265264
)
@@ -270,11 +269,10 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
270269
fn build_reduced_graph_for_external_crate_res(
271270
&self,
272271
child: &ModChild,
273-
parent_scope: ParentScope<'ra>,
272+
parent: Module<'ra>,
274273
child_index: usize,
275274
ambig_child: Option<&ModChild>,
276275
) {
277-
let parent = parent_scope.module;
278276
let child_span = |this: &Self, reexport_chain: &[Reexport], res: def::Res<_>| {
279277
this.def_span(
280278
reexport_chain
@@ -287,7 +285,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
287285
let ident = IdentKey::new(orig_ident);
288286
let span = child_span(self, reexport_chain, res);
289287
let res = res.expect_non_local();
290-
let expansion = parent_scope.expansion;
288+
let expansion = LocalExpnId::ROOT;
291289
let ambig = ambig_child.map(|ambig_child| {
292290
let ModChild { ident: _, res, vis, ref reexport_chain } = *ambig_child;
293291
let span = child_span(self, reexport_chain, res);

0 commit comments

Comments
 (0)