14
14
//! any imports resolved.
15
15
16
16
use { 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 ;
20
20
use Module ;
21
21
use ModuleKind :: * ;
22
22
use Namespace :: { TypeNS , ValueNS } ;
23
23
use NameBindings ;
24
+ use { names_to_string, module_to_string} ;
24
25
use ParentLink :: { self , ModuleParentLink , BlockParentLink } ;
25
26
use Resolver ;
26
- use Shadowable ;
27
+ use resolve_imports :: Shadowable ;
27
28
use TypeNsDef ;
28
29
29
30
use self :: DuplicateCheckingMode :: * ;
@@ -371,8 +372,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
371
372
372
373
ItemExternCrate ( _) => {
373
374
// 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 ) {
376
376
let def_id = DefId { krate : crate_id, node : 0 } ;
377
377
self . external_exports . insert ( def_id) ;
378
378
let parent_link = ModuleParentLink ( parent. downgrade ( ) , name) ;
@@ -382,7 +382,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
382
382
false ,
383
383
true ) ) ;
384
384
debug ! ( "(build reduced graph for item) found extern `{}`" ,
385
- self . module_to_string( & * external_module) ) ;
385
+ module_to_string( & * external_module) ) ;
386
386
self . check_for_conflicts_between_external_crates ( & * * parent, name, sp) ;
387
387
parent. external_module_children . borrow_mut ( )
388
388
. insert ( name, external_module. clone ( ) ) ;
@@ -400,7 +400,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
400
400
Some ( def_id) ,
401
401
NormalModuleKind ,
402
402
false ,
403
- item . vis == ast :: Public ,
403
+ is_public ,
404
404
sp) ;
405
405
406
406
name_bindings. get_module ( )
@@ -432,8 +432,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
432
432
// These items live in the type namespace.
433
433
ItemTy ( ..) => {
434
434
let name_bindings =
435
- self . add_child ( name, parent, ForbidDuplicateTypesAndModules ,
436
- sp) ;
435
+ self . add_child ( name, parent, ForbidDuplicateTypesAndModules , sp) ;
437
436
438
437
name_bindings. define_type ( DefTy ( local_def ( item. id ) , false ) , sp,
439
438
modifiers) ;
@@ -517,7 +516,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
517
516
Some ( local_def ( item. id ) ) ,
518
517
TraitModuleKind ,
519
518
false ,
520
- item . vis == ast :: Public ,
519
+ is_public ,
521
520
sp) ;
522
521
let module_parent = name_bindings. get_module ( ) ;
523
522
@@ -636,8 +635,8 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
636
635
name : Name ,
637
636
new_parent : & Rc < Module > ) {
638
637
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) ;
641
640
let is_public = vis == ast:: Public ;
642
641
let modifiers = if is_public { PUBLIC } else { DefModifiers :: empty ( ) } | IMPORTABLE ;
643
642
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> {
667
666
Some ( _) | None => {
668
667
debug ! ( "(building reduced graph for \
669
668
external crate) building module \
670
- {}", final_ident) ;
669
+ {} {} ", final_ident, is_public ) ;
671
670
let parent_link = self . get_parent_link ( new_parent, name) ;
672
671
673
672
child_name_bindings. define_module ( parent_link,
@@ -838,7 +837,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
838
837
/// Builds the reduced graph rooted at the given external module.
839
838
fn populate_external_module ( & mut self , module : & Rc < Module > ) {
840
839
debug ! ( "(populating external module) attempting to populate {}" ,
841
- self . module_to_string( & * * module) ) ;
840
+ module_to_string( & * * module) ) ;
842
841
843
842
let def_id = match module. def_id . get ( ) {
844
843
None => {
@@ -904,18 +903,14 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
904
903
905
904
match subclass {
906
905
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) ,
911
908
token:: get_name( target) ) ;
912
909
913
- let mut import_resolutions = module_. import_resolutions
914
- . borrow_mut ( ) ;
910
+ let mut import_resolutions = module_. import_resolutions . borrow_mut ( ) ;
915
911
match import_resolutions. get_mut ( & target) {
916
912
Some ( resolution) => {
917
- debug ! ( "(building import directive) bumping \
918
- reference") ;
913
+ debug ! ( "(building import directive) bumping reference" ) ;
919
914
resolution. outstanding_references += 1 ;
920
915
921
916
// the source of this name is different now
0 commit comments