Skip to content

Commit ff014a3

Browse files
committed
Refactor away populate_external_module
1 parent 7bc6c75 commit ff014a3

File tree

1 file changed

+4
-25
lines changed

1 file changed

+4
-25
lines changed

src/librustc_resolve/build_reduced_graph.rs

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ use resolve_imports::ImportDirectiveSubclass::{self, SingleImport, GlobImport};
1919
use Module;
2020
use Namespace::{self, TypeNS, ValueNS};
2121
use {NameBinding, NameBindingKind};
22-
use module_to_string;
2322
use ParentLink::{ModuleParentLink, BlockParentLink};
2423
use Resolver;
2524
use {resolve_error, resolve_struct_error, ResolutionError};
@@ -547,34 +546,14 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
547546
}
548547
}
549548

550-
/// Builds the reduced graph rooted at the given external module.
551-
fn populate_external_module(&mut self, module: Module<'b>) {
552-
debug!("(populating external module) attempting to populate {}",
553-
module_to_string(module));
554-
555-
let def_id = match module.def_id() {
556-
None => {
557-
debug!("(populating external module) ... no def ID!");
558-
return;
559-
}
560-
Some(def_id) => def_id,
561-
};
562-
563-
for child in self.session.cstore.item_children(def_id) {
564-
debug!("(populating external module) ... found ident: {}",
565-
child.name);
566-
self.build_reduced_graph_for_external_crate_def(module, child);
567-
}
568-
module.populated.set(true)
569-
}
570-
571549
/// Ensures that the reduced graph rooted at the given external module
572550
/// is built, building it if it is not.
573551
fn populate_module_if_necessary(&mut self, module: Module<'b>) {
574-
if !module.populated.get() {
575-
self.populate_external_module(module)
552+
if module.populated.get() { return }
553+
for child in self.session.cstore.item_children(module.def_id().unwrap()) {
554+
self.build_reduced_graph_for_external_crate_def(module, child);
576555
}
577-
assert!(module.populated.get())
556+
module.populated.set(true)
578557
}
579558

580559
/// Builds the reduced graph rooted at the 'use' directive for an external

0 commit comments

Comments
 (0)