@@ -105,9 +105,8 @@ pub enum TypeNs {
105105 BuiltinType ( BuiltinType ) ,
106106 TraitId ( TraitId ) ,
107107 TraitAliasId ( TraitAliasId ) ,
108- // Module belong to type ns, but the resolver is used when all module paths
109- // are fully resolved.
110- // ModuleId(ModuleId)
108+
109+ ModuleId ( ModuleId ) ,
111110}
112111
113112#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
@@ -249,6 +248,24 @@ impl Resolver {
249248 }
250249 Scope :: BlockScope ( m) => {
251250 if let Some ( res) = m. resolve_path_in_type_ns ( db, path) {
251+ let res = match res. 0 {
252+ TypeNs :: ModuleId ( _) if res. 1 . is_none ( ) => {
253+ if let Some ( ModuleDefId :: BuiltinType ( builtin) ) = BUILTIN_SCOPE
254+ . get ( first_name)
255+ . and_then ( |builtin| builtin. take_types ( ) )
256+ {
257+ (
258+ TypeNs :: BuiltinType ( builtin) ,
259+ remaining_idx ( ) ,
260+ None ,
261+ ResolvePathResultPrefixInfo :: default ( ) ,
262+ )
263+ } else {
264+ res
265+ }
266+ }
267+ _ => res,
268+ } ;
252269 return Some ( res) ;
253270 }
254271 }
@@ -1193,11 +1210,12 @@ fn to_type_ns(per_ns: PerNs) -> Option<(TypeNs, Option<ImportOrExternCrate>)> {
11931210 ModuleDefId :: TraitId ( it) => TypeNs :: TraitId ( it) ,
11941211 ModuleDefId :: TraitAliasId ( it) => TypeNs :: TraitAliasId ( it) ,
11951212
1213+ ModuleDefId :: ModuleId ( it) => TypeNs :: ModuleId ( it) ,
1214+
11961215 ModuleDefId :: FunctionId ( _)
11971216 | ModuleDefId :: ConstId ( _)
11981217 | ModuleDefId :: MacroId ( _)
1199- | ModuleDefId :: StaticId ( _)
1200- | ModuleDefId :: ModuleId ( _) => return None ,
1218+ | ModuleDefId :: StaticId ( _) => return None ,
12011219 } ;
12021220 Some ( ( res, def. import ) )
12031221}
0 commit comments