1818#![ cfg_attr( not( stage0) , deny( warnings) ) ]
1919
2020#![ feature( associated_consts) ]
21- #![ feature( borrow_state) ]
2221#![ feature( rustc_diagnostic_macros) ]
2322#![ feature( rustc_private) ]
2423#![ feature( staged_api) ]
@@ -799,7 +798,7 @@ pub struct ModuleS<'a> {
799798 is_extern_crate : bool ,
800799
801800 resolutions : RefCell < HashMap < ( Name , Namespace ) , NameResolution < ' a > > > ,
802- imports : RefCell < Vec < ImportDirective > > ,
801+ unresolved_imports : RefCell < Vec < ImportDirective > > ,
803802
804803 // The module children of this node, including normal modules and anonymous modules.
805804 // Anonymous children are pseudo-modules that are implicitly created around items
@@ -828,9 +827,6 @@ pub struct ModuleS<'a> {
828827 // The number of unresolved pub glob imports in this module
829828 pub_glob_count : Cell < usize > ,
830829
831- // The index of the import we're resolving.
832- resolved_import_count : Cell < usize > ,
833-
834830 // Whether this module is populated. If not populated, any attempt to
835831 // access the children must be preceded with a
836832 // `populate_module_if_necessary` call.
@@ -847,13 +843,12 @@ impl<'a> ModuleS<'a> {
847843 is_public : is_public,
848844 is_extern_crate : false ,
849845 resolutions : RefCell :: new ( HashMap :: new ( ) ) ,
850- imports : RefCell :: new ( Vec :: new ( ) ) ,
846+ unresolved_imports : RefCell :: new ( Vec :: new ( ) ) ,
851847 module_children : RefCell :: new ( NodeMap ( ) ) ,
852848 shadowed_traits : RefCell :: new ( Vec :: new ( ) ) ,
853849 glob_count : Cell :: new ( 0 ) ,
854850 pub_count : Cell :: new ( 0 ) ,
855851 pub_glob_count : Cell :: new ( 0 ) ,
856- resolved_import_count : Cell :: new ( 0 ) ,
857852 populated : Cell :: new ( !external) ,
858853 }
859854 }
@@ -924,15 +919,6 @@ impl<'a> ModuleS<'a> {
924919 }
925920 }
926921
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-
936922 pub fn inc_glob_count ( & self ) {
937923 self . glob_count . set ( self . glob_count . get ( ) + 1 ) ;
938924 }
@@ -1622,13 +1608,9 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
16221608 }
16231609
16241610 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 ;
16321614 }
16331615
16341616 // Descend into children and anonymous children.
0 commit comments