@@ -105,9 +105,8 @@ pub enum TypeNs {
105
105
BuiltinType ( BuiltinType ) ,
106
106
TraitId ( TraitId ) ,
107
107
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 ) ,
111
110
}
112
111
113
112
#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
@@ -249,6 +248,24 @@ impl Resolver {
249
248
}
250
249
Scope :: BlockScope ( m) => {
251
250
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
+ } ;
252
269
return Some ( res) ;
253
270
}
254
271
}
@@ -1193,11 +1210,12 @@ fn to_type_ns(per_ns: PerNs) -> Option<(TypeNs, Option<ImportOrExternCrate>)> {
1193
1210
ModuleDefId :: TraitId ( it) => TypeNs :: TraitId ( it) ,
1194
1211
ModuleDefId :: TraitAliasId ( it) => TypeNs :: TraitAliasId ( it) ,
1195
1212
1213
+ ModuleDefId :: ModuleId ( it) => TypeNs :: ModuleId ( it) ,
1214
+
1196
1215
ModuleDefId :: FunctionId ( _)
1197
1216
| ModuleDefId :: ConstId ( _)
1198
1217
| ModuleDefId :: MacroId ( _)
1199
- | ModuleDefId :: StaticId ( _)
1200
- | ModuleDefId :: ModuleId ( _) => return None ,
1218
+ | ModuleDefId :: StaticId ( _) => return None ,
1201
1219
} ;
1202
1220
Some ( ( res, def. import ) )
1203
1221
}
0 commit comments