@@ -14,7 +14,7 @@ use crate::{
14
14
nameres:: CrateModuleId ,
15
15
resolve:: Resolver ,
16
16
traits:: TraitItem ,
17
- ty:: primitive:: { UncertainFloatTy , UncertainIntTy } ,
17
+ ty:: primitive:: { FloatBitness , UncertainFloatTy , UncertainIntTy } ,
18
18
ty:: { Ty , TypeCtor } ,
19
19
Crate , Function , HirDatabase , Module , Name , Trait ,
20
20
} ;
@@ -132,9 +132,11 @@ fn def_crates(db: &impl HirDatabase, cur_crate: Crate, ty: &Ty) -> Option<ArrayV
132
132
TypeCtor :: Adt ( def_id) => Some ( std:: iter:: once ( def_id. krate ( db) ?) . collect ( ) ) ,
133
133
TypeCtor :: Bool => lang_item_crate ! ( db, cur_crate, "bool" ) ,
134
134
TypeCtor :: Char => lang_item_crate ! ( db, cur_crate, "char" ) ,
135
- TypeCtor :: Float ( UncertainFloatTy :: Known ( f) ) => {
136
- lang_item_crate ! ( db, cur_crate, f. ty_to_string( ) )
137
- }
135
+ TypeCtor :: Float ( UncertainFloatTy :: Known ( f) ) => match f. bitness {
136
+ // There are two lang items: one in libcore (fXX) and one in libstd (fXX_runtime)
137
+ FloatBitness :: X32 => lang_item_crate ! ( db, cur_crate, "f32" , "f32_runtime" ) ,
138
+ FloatBitness :: X64 => lang_item_crate ! ( db, cur_crate, "f64" , "f64_runtime" ) ,
139
+ } ,
138
140
TypeCtor :: Int ( UncertainIntTy :: Known ( i) ) => {
139
141
lang_item_crate ! ( db, cur_crate, i. ty_to_string( ) )
140
142
}
0 commit comments