@@ -167,7 +167,7 @@ pub struct ItemScope {
167167 // the resolutions of the imports of this scope
168168 use_imports_types : FxHashMap < ImportOrExternCrate , ImportOrDef > ,
169169 use_imports_values : FxHashMap < ImportOrGlob , ImportOrDef > ,
170- use_imports_macros : FxHashMap < ImportOrGlob , ImportOrDef > ,
170+ use_imports_macros : FxHashMap < ImportOrExternCrate , ImportOrDef > ,
171171
172172 use_decls : Vec < UseId > ,
173173 extern_crate_decls : Vec < ExternCrateId > ,
@@ -242,17 +242,17 @@ impl ItemScope {
242242 self . types . iter ( ) . map ( |( n, & i) | ( n, i) )
243243 }
244244
245- pub fn macros ( & self ) -> impl Iterator < Item = ( & Name , Item < MacroId , ImportOrGlob > ) > + ' _ {
245+ pub fn macros ( & self ) -> impl Iterator < Item = ( & Name , Item < MacroId , ImportOrExternCrate > ) > + ' _ {
246246 self . macros . iter ( ) . map ( |( n, & i) | ( n, i) )
247247 }
248248
249249 pub fn imports ( & self ) -> impl Iterator < Item = ImportId > + ' _ {
250250 self . use_imports_types
251251 . keys ( )
252252 . copied ( )
253+ . chain ( self . use_imports_macros . keys ( ) . copied ( ) )
253254 . filter_map ( ImportOrExternCrate :: import_or_glob)
254255 . chain ( self . use_imports_values . keys ( ) . copied ( ) )
255- . chain ( self . use_imports_macros . keys ( ) . copied ( ) )
256256 . filter_map ( ImportOrGlob :: into_import)
257257 . sorted ( )
258258 . dedup ( )
@@ -263,7 +263,7 @@ impl ItemScope {
263263
264264 let mut def_map;
265265 let mut scope = self ;
266- while let Some ( & m) = scope. use_imports_macros . get ( & ImportOrGlob :: Import ( import) ) {
266+ while let Some ( & m) = scope. use_imports_macros . get ( & ImportOrExternCrate :: Import ( import) ) {
267267 match m {
268268 ImportOrDef :: Import ( i) => {
269269 let module_id = i. use_ . lookup ( db) . container ;
@@ -682,7 +682,6 @@ impl ItemScope {
682682 }
683683 _ => _ = glob_imports. macros . remove ( & lookup) ,
684684 }
685- let import = import. and_then ( ImportOrExternCrate :: import_or_glob) ;
686685 let prev = std:: mem:: replace ( & mut fld. import , import) ;
687686 if let Some ( import) = import {
688687 self . use_imports_macros . insert (
@@ -698,7 +697,6 @@ impl ItemScope {
698697 {
699698 if glob_imports. macros . remove ( & lookup) {
700699 cov_mark:: hit!( import_shadowed) ;
701- let import = import. and_then ( ImportOrExternCrate :: import_or_glob) ;
702700 let prev = std:: mem:: replace ( & mut fld. import , import) ;
703701 if let Some ( import) = import {
704702 self . use_imports_macros . insert (
@@ -783,8 +781,9 @@ impl ItemScope {
783781 if let Some ( Item { import, .. } ) = def. macros {
784782 buf. push_str ( " m" ) ;
785783 match import {
786- Some ( ImportOrGlob :: Import ( _) ) => buf. push ( 'i' ) ,
787- Some ( ImportOrGlob :: Glob ( _) ) => buf. push ( 'g' ) ,
784+ Some ( ImportOrExternCrate :: Import ( _) ) => buf. push ( 'i' ) ,
785+ Some ( ImportOrExternCrate :: Glob ( _) ) => buf. push ( 'g' ) ,
786+ Some ( ImportOrExternCrate :: ExternCrate ( _) ) => buf. push ( 'e' ) ,
788787 None => ( ) ,
789788 }
790789 }
@@ -893,9 +892,7 @@ impl PerNs {
893892 ModuleDefId :: TraitAliasId ( _) => PerNs :: types ( def, v, import) ,
894893 ModuleDefId :: TypeAliasId ( _) => PerNs :: types ( def, v, import) ,
895894 ModuleDefId :: BuiltinType ( _) => PerNs :: types ( def, v, import) ,
896- ModuleDefId :: MacroId ( mac) => {
897- PerNs :: macros ( mac, v, import. and_then ( ImportOrExternCrate :: import_or_glob) )
898- }
895+ ModuleDefId :: MacroId ( mac) => PerNs :: macros ( mac, v, import) ,
899896 }
900897 }
901898}
0 commit comments