@@ -167,7 +167,7 @@ pub struct ItemScope {
167
167
// the resolutions of the imports of this scope
168
168
use_imports_types : FxHashMap < ImportOrExternCrate , ImportOrDef > ,
169
169
use_imports_values : FxHashMap < ImportOrGlob , ImportOrDef > ,
170
- use_imports_macros : FxHashMap < ImportOrGlob , ImportOrDef > ,
170
+ use_imports_macros : FxHashMap < ImportOrExternCrate , ImportOrDef > ,
171
171
172
172
use_decls : Vec < UseId > ,
173
173
extern_crate_decls : Vec < ExternCrateId > ,
@@ -242,17 +242,17 @@ impl ItemScope {
242
242
self . types . iter ( ) . map ( |( n, & i) | ( n, i) )
243
243
}
244
244
245
- pub fn macros ( & self ) -> impl Iterator < Item = ( & Name , Item < MacroId , ImportOrGlob > ) > + ' _ {
245
+ pub fn macros ( & self ) -> impl Iterator < Item = ( & Name , Item < MacroId , ImportOrExternCrate > ) > + ' _ {
246
246
self . macros . iter ( ) . map ( |( n, & i) | ( n, i) )
247
247
}
248
248
249
249
pub fn imports ( & self ) -> impl Iterator < Item = ImportId > + ' _ {
250
250
self . use_imports_types
251
251
. keys ( )
252
252
. copied ( )
253
+ . chain ( self . use_imports_macros . keys ( ) . copied ( ) )
253
254
. filter_map ( ImportOrExternCrate :: import_or_glob)
254
255
. chain ( self . use_imports_values . keys ( ) . copied ( ) )
255
- . chain ( self . use_imports_macros . keys ( ) . copied ( ) )
256
256
. filter_map ( ImportOrGlob :: into_import)
257
257
. sorted ( )
258
258
. dedup ( )
@@ -263,7 +263,7 @@ impl ItemScope {
263
263
264
264
let mut def_map;
265
265
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) ) {
267
267
match m {
268
268
ImportOrDef :: Import ( i) => {
269
269
let module_id = i. use_ . lookup ( db) . container ;
@@ -682,7 +682,6 @@ impl ItemScope {
682
682
}
683
683
_ => _ = glob_imports. macros . remove ( & lookup) ,
684
684
}
685
- let import = import. and_then ( ImportOrExternCrate :: import_or_glob) ;
686
685
let prev = std:: mem:: replace ( & mut fld. import , import) ;
687
686
if let Some ( import) = import {
688
687
self . use_imports_macros . insert (
@@ -698,7 +697,6 @@ impl ItemScope {
698
697
{
699
698
if glob_imports. macros . remove ( & lookup) {
700
699
cov_mark:: hit!( import_shadowed) ;
701
- let import = import. and_then ( ImportOrExternCrate :: import_or_glob) ;
702
700
let prev = std:: mem:: replace ( & mut fld. import , import) ;
703
701
if let Some ( import) = import {
704
702
self . use_imports_macros . insert (
@@ -783,8 +781,9 @@ impl ItemScope {
783
781
if let Some ( Item { import, .. } ) = def. macros {
784
782
buf. push_str ( " m" ) ;
785
783
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' ) ,
788
787
None => ( ) ,
789
788
}
790
789
}
@@ -893,9 +892,7 @@ impl PerNs {
893
892
ModuleDefId :: TraitAliasId ( _) => PerNs :: types ( def, v, import) ,
894
893
ModuleDefId :: TypeAliasId ( _) => PerNs :: types ( def, v, import) ,
895
894
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) ,
899
896
}
900
897
}
901
898
}
0 commit comments