mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-15 01:17:27 +00:00
Merge #1906
1906: Add missing lang-items to `def_crates` r=matklad a=sinkuu Co-authored-by: Shotaro Yamada <sinkuu@sinkuu.xyz>
This commit is contained in:
commit
63433ba79a
1 changed files with 5 additions and 2 deletions
|
@ -16,6 +16,7 @@ use crate::{
|
|||
resolve::Resolver,
|
||||
ty::primitive::{FloatBitness, UncertainFloatTy, UncertainIntTy},
|
||||
ty::{Ty, TypeCtor},
|
||||
type_ref::Mutability,
|
||||
AssocItem, Crate, Function, Module, Name, Trait,
|
||||
};
|
||||
|
||||
|
@ -130,7 +131,7 @@ fn def_crates(db: &impl HirDatabase, cur_crate: Crate, ty: &Ty) -> Option<ArrayV
|
|||
($db:expr, $cur_crate:expr, $($name:expr),+ $(,)?) => {{
|
||||
let mut v = ArrayVec::<[Crate; 2]>::new();
|
||||
$(
|
||||
v.push($db.lang_item($cur_crate, $name.into())?.krate($db)?);
|
||||
v.extend($db.lang_item($cur_crate, $name.into()).and_then(|item| item.krate($db)));
|
||||
)+
|
||||
Some(v)
|
||||
}};
|
||||
|
@ -149,8 +150,10 @@ fn def_crates(db: &impl HirDatabase, cur_crate: Crate, ty: &Ty) -> Option<ArrayV
|
|||
TypeCtor::Int(UncertainIntTy::Known(i)) => {
|
||||
lang_item_crate!(db, cur_crate, i.ty_to_string())
|
||||
}
|
||||
TypeCtor::Str => lang_item_crate!(db, cur_crate, "str"),
|
||||
TypeCtor::Str => lang_item_crate!(db, cur_crate, "str_alloc", "str"),
|
||||
TypeCtor::Slice => lang_item_crate!(db, cur_crate, "slice_alloc", "slice"),
|
||||
TypeCtor::RawPtr(Mutability::Shared) => lang_item_crate!(db, cur_crate, "const_ptr"),
|
||||
TypeCtor::RawPtr(Mutability::Mut) => lang_item_crate!(db, cur_crate, "mut_ptr"),
|
||||
_ => None,
|
||||
},
|
||||
_ => None,
|
||||
|
|
Loading…
Reference in a new issue