@@ -77,8 +77,8 @@ use crate::{
7777 path:: ModPath ,
7878 per_ns:: PerNs ,
7979 visibility:: Visibility ,
80- AstId , BlockId , BlockLoc , CrateRootModuleId , FunctionId , LocalModuleId , Lookup , MacroExpander ,
81- MacroId , ModuleId , ProcMacroId ,
80+ AstId , BlockId , BlockLoc , CrateRootModuleId , ExternCrateId , FunctionId , LocalModuleId , Lookup ,
81+ MacroExpander , MacroId , ModuleId , ProcMacroId , UseId ,
8282} ;
8383
8484/// Contains the results of (early) name resolution.
@@ -105,10 +105,10 @@ pub struct DefMap {
105105 /// The prelude is empty for non-block DefMaps (unless `#[prelude_import]` was used,
106106 /// but that attribute is nightly and when used in a block, it affects resolution globally
107107 /// so we aren't handling this correctly anyways).
108- prelude : Option < ModuleId > ,
108+ prelude : Option < ( ModuleId , Option < UseId > ) > ,
109109 /// `macro_use` prelude that contains macros from `#[macro_use]`'d external crates. Note that
110110 /// this contains all kinds of macro, not just `macro_rules!` macro.
111- macro_use_prelude : FxHashMap < Name , MacroId > ,
111+ macro_use_prelude : FxHashMap < Name , ( MacroId , Option < ExternCrateId > ) > ,
112112
113113 /// Tracks which custom derives are in scope for an item, to allow resolution of derive helper
114114 /// attributes.
@@ -125,7 +125,7 @@ pub struct DefMap {
125125#[ derive( Clone , Debug , PartialEq , Eq ) ]
126126struct DefMapCrateData {
127127 /// The extern prelude which contains all root modules of external crates that are in scope.
128- extern_prelude : FxHashMap < Name , CrateRootModuleId > ,
128+ extern_prelude : FxHashMap < Name , ( CrateRootModuleId , Option < ExternCrateId > ) > ,
129129
130130 /// Side table for resolving derive helpers.
131131 exported_derives : FxHashMap < MacroDefId , Box < [ Name ] > > ,
@@ -427,15 +427,19 @@ impl DefMap {
427427 self . block . map ( |block| block. block )
428428 }
429429
430- pub ( crate ) fn prelude ( & self ) -> Option < ModuleId > {
430+ pub ( crate ) fn prelude ( & self ) -> Option < ( ModuleId , Option < UseId > ) > {
431431 self . prelude
432432 }
433433
434- pub ( crate ) fn extern_prelude ( & self ) -> impl Iterator < Item = ( & Name , ModuleId ) > + ' _ {
435- self . data . extern_prelude . iter ( ) . map ( |( name, & def) | ( name, def. into ( ) ) )
434+ pub ( crate ) fn extern_prelude (
435+ & self ,
436+ ) -> impl Iterator < Item = ( & Name , ( CrateRootModuleId , Option < ExternCrateId > ) ) > + ' _ {
437+ self . data . extern_prelude . iter ( ) . map ( |( name, & def) | ( name, def) )
436438 }
437439
438- pub ( crate ) fn macro_use_prelude ( & self ) -> impl Iterator < Item = ( & Name , MacroId ) > + ' _ {
440+ pub ( crate ) fn macro_use_prelude (
441+ & self ,
442+ ) -> impl Iterator < Item = ( & Name , ( MacroId , Option < ExternCrateId > ) ) > + ' _ {
439443 self . macro_use_prelude . iter ( ) . map ( |( name, & def) | ( name, def) )
440444 }
441445
0 commit comments