Add missing lang-items to def_crates

This commit is contained in:
Shotaro Yamada
2019-09-25 11:29:46 +09:00
parent c7420ddaaa
commit 89d0ff1623
+5 -2
View File
@@ -16,6 +16,7 @@
resolve::Resolver,
ty::primitive::{FloatBitness, UncertainFloatTy, UncertainIntTy},
ty::{Ty, TypeCtor},
type_ref::Mutability,
AssocItem, Crate, Function, Module, Name, Trait,
};
@@ -130,7 +131,7 @@ macro_rules! lang_item_crate {
($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 @@ macro_rules! lang_item_crate {
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,