18
18
#![ cfg_attr( not( stage0) , deny( warnings) ) ]
19
19
20
20
#![ feature( associated_consts) ]
21
- #![ feature( borrow_state) ]
22
21
#![ feature( rustc_diagnostic_macros) ]
23
22
#![ feature( rustc_private) ]
24
23
#![ feature( staged_api) ]
@@ -799,7 +798,7 @@ pub struct ModuleS<'a> {
799
798
is_extern_crate : bool ,
800
799
801
800
resolutions : RefCell < HashMap < ( Name , Namespace ) , NameResolution < ' a > > > ,
802
- imports : RefCell < Vec < ImportDirective > > ,
801
+ unresolved_imports : RefCell < Vec < ImportDirective > > ,
803
802
804
803
// The module children of this node, including normal modules and anonymous modules.
805
804
// Anonymous children are pseudo-modules that are implicitly created around items
@@ -828,9 +827,6 @@ pub struct ModuleS<'a> {
828
827
// The number of unresolved pub glob imports in this module
829
828
pub_glob_count : Cell < usize > ,
830
829
831
- // The index of the import we're resolving.
832
- resolved_import_count : Cell < usize > ,
833
-
834
830
// Whether this module is populated. If not populated, any attempt to
835
831
// access the children must be preceded with a
836
832
// `populate_module_if_necessary` call.
@@ -847,13 +843,12 @@ impl<'a> ModuleS<'a> {
847
843
is_public : is_public,
848
844
is_extern_crate : false ,
849
845
resolutions : RefCell :: new ( HashMap :: new ( ) ) ,
850
- imports : RefCell :: new ( Vec :: new ( ) ) ,
846
+ unresolved_imports : RefCell :: new ( Vec :: new ( ) ) ,
851
847
module_children : RefCell :: new ( NodeMap ( ) ) ,
852
848
shadowed_traits : RefCell :: new ( Vec :: new ( ) ) ,
853
849
glob_count : Cell :: new ( 0 ) ,
854
850
pub_count : Cell :: new ( 0 ) ,
855
851
pub_glob_count : Cell :: new ( 0 ) ,
856
- resolved_import_count : Cell :: new ( 0 ) ,
857
852
populated : Cell :: new ( !external) ,
858
853
}
859
854
}
@@ -924,15 +919,6 @@ impl<'a> ModuleS<'a> {
924
919
}
925
920
}
926
921
927
- fn all_imports_resolved ( & self ) -> bool {
928
- if self . imports . borrow_state ( ) == :: std:: cell:: BorrowState :: Writing {
929
- // it is currently being resolved ! so nope
930
- false
931
- } else {
932
- self . imports . borrow ( ) . len ( ) == self . resolved_import_count . get ( )
933
- }
934
- }
935
-
936
922
pub fn inc_glob_count ( & self ) {
937
923
self . glob_count . set ( self . glob_count . get ( ) + 1 ) ;
938
924
}
@@ -1622,13 +1608,9 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
1622
1608
}
1623
1609
1624
1610
fn report_unresolved_imports ( & mut self , module_ : Module < ' a > ) {
1625
- let index = module_. resolved_import_count . get ( ) ;
1626
- let imports = module_. imports . borrow ( ) ;
1627
- let import_count = imports. len ( ) ;
1628
- if index != import_count {
1629
- resolve_error ( self ,
1630
- ( * imports) [ index] . span ,
1631
- ResolutionError :: UnresolvedImport ( None ) ) ;
1611
+ for import in module_. unresolved_imports . borrow ( ) . iter ( ) {
1612
+ resolve_error ( self , import. span , ResolutionError :: UnresolvedImport ( None ) ) ;
1613
+ break ;
1632
1614
}
1633
1615
1634
1616
// Descend into children and anonymous children.
0 commit comments