1414//! any imports resolved.
1515
1616use { DefModifiers , PUBLIC , IMPORTABLE } ;
17- use ImportDirective ;
18- use ImportDirectiveSubclass :: { self , SingleImport , GlobImport } ;
19- use ImportResolution ;
17+ use resolve_imports :: ImportDirective ;
18+ use resolve_imports :: ImportDirectiveSubclass :: { self , SingleImport , GlobImport } ;
19+ use resolve_imports :: ImportResolution ;
2020use Module ;
2121use ModuleKind :: * ;
2222use Namespace :: { TypeNS , ValueNS } ;
2323use NameBindings ;
24+ use { names_to_string, module_to_string} ;
2425use ParentLink :: { self , ModuleParentLink , BlockParentLink } ;
2526use Resolver ;
26- use Shadowable ;
27+ use resolve_imports :: Shadowable ;
2728use TypeNsDef ;
2829
2930use self :: DuplicateCheckingMode :: * ;
@@ -371,8 +372,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
371372
372373 ItemExternCrate ( _) => {
373374 // n.b. we don't need to look at the path option here, because cstore already did
374- for & crate_id in self . session . cstore
375- . find_extern_mod_stmt_cnum ( item. id ) . iter ( ) {
375+ if let Some ( crate_id) = self . session . cstore . find_extern_mod_stmt_cnum ( item. id ) {
376376 let def_id = DefId { krate : crate_id, node : 0 } ;
377377 self . external_exports . insert ( def_id) ;
378378 let parent_link = ModuleParentLink ( parent. downgrade ( ) , name) ;
@@ -382,7 +382,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
382382 false ,
383383 true ) ) ;
384384 debug ! ( "(build reduced graph for item) found extern `{}`" ,
385- self . module_to_string( & * external_module) ) ;
385+ module_to_string( & * external_module) ) ;
386386 self . check_for_conflicts_between_external_crates ( & * * parent, name, sp) ;
387387 parent. external_module_children . borrow_mut ( )
388388 . insert ( name, external_module. clone ( ) ) ;
@@ -400,7 +400,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
400400 Some ( def_id) ,
401401 NormalModuleKind ,
402402 false ,
403- item . vis == ast :: Public ,
403+ is_public ,
404404 sp) ;
405405
406406 name_bindings. get_module ( )
@@ -432,8 +432,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
432432 // These items live in the type namespace.
433433 ItemTy ( ..) => {
434434 let name_bindings =
435- self . add_child ( name, parent, ForbidDuplicateTypesAndModules ,
436- sp) ;
435+ self . add_child ( name, parent, ForbidDuplicateTypesAndModules , sp) ;
437436
438437 name_bindings. define_type ( DefTy ( local_def ( item. id ) , false ) , sp,
439438 modifiers) ;
@@ -517,7 +516,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
517516 Some ( local_def ( item. id ) ) ,
518517 TraitModuleKind ,
519518 false ,
520- item . vis == ast :: Public ,
519+ is_public ,
521520 sp) ;
522521 let module_parent = name_bindings. get_module ( ) ;
523522
@@ -636,8 +635,8 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
636635 name : Name ,
637636 new_parent : & Rc < Module > ) {
638637 debug ! ( "(building reduced graph for \
639- external crate) building external def, priv {:?}",
640- vis) ;
638+ external crate) building external def {} , priv {:?}",
639+ final_ident , vis) ;
641640 let is_public = vis == ast:: Public ;
642641 let modifiers = if is_public { PUBLIC } else { DefModifiers :: empty ( ) } | IMPORTABLE ;
643642 let is_exported = is_public && match new_parent. def_id . get ( ) {
@@ -667,7 +666,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
667666 Some ( _) | None => {
668667 debug ! ( "(building reduced graph for \
669668 external crate) building module \
670- {}", final_ident) ;
669+ {} {} ", final_ident, is_public ) ;
671670 let parent_link = self . get_parent_link ( new_parent, name) ;
672671
673672 child_name_bindings. define_module ( parent_link,
@@ -838,7 +837,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
838837 /// Builds the reduced graph rooted at the given external module.
839838 fn populate_external_module ( & mut self , module : & Rc < Module > ) {
840839 debug ! ( "(populating external module) attempting to populate {}" ,
841- self . module_to_string( & * * module) ) ;
840+ module_to_string( & * * module) ) ;
842841
843842 let def_id = match module. def_id . get ( ) {
844843 None => {
@@ -904,18 +903,14 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
904903
905904 match subclass {
906905 SingleImport ( target, _) => {
907- debug ! ( "(building import directive) building import \
908- directive: {}::{}",
909- self . names_to_string( & module_. imports. borrow( ) . last( ) . unwrap( ) .
910- module_path) ,
906+ debug ! ( "(building import directive) building import directive: {}::{}" ,
907+ names_to_string( & module_. imports. borrow( ) . last( ) . unwrap( ) . module_path) ,
911908 token:: get_name( target) ) ;
912909
913- let mut import_resolutions = module_. import_resolutions
914- . borrow_mut ( ) ;
910+ let mut import_resolutions = module_. import_resolutions . borrow_mut ( ) ;
915911 match import_resolutions. get_mut ( & target) {
916912 Some ( resolution) => {
917- debug ! ( "(building import directive) bumping \
918- reference") ;
913+ debug ! ( "(building import directive) bumping reference" ) ;
919914 resolution. outstanding_references += 1 ;
920915
921916 // the source of this name is different now
0 commit comments