mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +00:00
Look for the fXX_runtime lang items during method resolution.
This commit is contained in:
parent
3210002201
commit
95d78a8d8d
@ -14,7 +14,7 @@ use crate::{
|
|||||||
nameres::CrateModuleId,
|
nameres::CrateModuleId,
|
||||||
resolve::Resolver,
|
resolve::Resolver,
|
||||||
traits::TraitItem,
|
traits::TraitItem,
|
||||||
ty::primitive::{UncertainFloatTy, UncertainIntTy},
|
ty::primitive::{FloatBitness, UncertainFloatTy, UncertainIntTy},
|
||||||
ty::{Ty, TypeCtor},
|
ty::{Ty, TypeCtor},
|
||||||
Crate, Function, HirDatabase, Module, Name, Trait,
|
Crate, Function, HirDatabase, Module, Name, Trait,
|
||||||
};
|
};
|
||||||
@ -132,9 +132,11 @@ fn def_crates(db: &impl HirDatabase, cur_crate: Crate, ty: &Ty) -> Option<ArrayV
|
|||||||
TypeCtor::Adt(def_id) => Some(std::iter::once(def_id.krate(db)?).collect()),
|
TypeCtor::Adt(def_id) => Some(std::iter::once(def_id.krate(db)?).collect()),
|
||||||
TypeCtor::Bool => lang_item_crate!(db, cur_crate, "bool"),
|
TypeCtor::Bool => lang_item_crate!(db, cur_crate, "bool"),
|
||||||
TypeCtor::Char => lang_item_crate!(db, cur_crate, "char"),
|
TypeCtor::Char => lang_item_crate!(db, cur_crate, "char"),
|
||||||
TypeCtor::Float(UncertainFloatTy::Known(f)) => {
|
TypeCtor::Float(UncertainFloatTy::Known(f)) => match f.bitness {
|
||||||
lang_item_crate!(db, cur_crate, f.ty_to_string())
|
// There are two lang items: one in libcore (fXX) and one in libstd (fXX_runtime)
|
||||||
}
|
FloatBitness::X32 => lang_item_crate!(db, cur_crate, "f32", "f32_runtime"),
|
||||||
|
FloatBitness::X64 => lang_item_crate!(db, cur_crate, "f64", "f64_runtime"),
|
||||||
|
},
|
||||||
TypeCtor::Int(UncertainIntTy::Known(i)) => {
|
TypeCtor::Int(UncertainIntTy::Known(i)) => {
|
||||||
lang_item_crate!(db, cur_crate, i.ty_to_string())
|
lang_item_crate!(db, cur_crate, i.ty_to_string())
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user