aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorShotaro Yamada <[email protected]>2019-09-25 03:29:46 +0100
committerShotaro Yamada <[email protected]>2019-09-25 04:02:53 +0100
commit89d0ff16230a082dd6c8f3eb4330481e6db68b44 (patch)
tree16b7e317487c76e20f263b7c0c558da13fb528c8 /crates
parentc7420ddaaa76741d1eebe393406b38ba5596e54a (diff)
Add missing lang-items to `def_crates`
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_hir/src/ty/method_resolution.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/crates/ra_hir/src/ty/method_resolution.rs b/crates/ra_hir/src/ty/method_resolution.rs
index 8b46b11a9..7ec96debb 100644
--- a/crates/ra_hir/src/ty/method_resolution.rs
+++ b/crates/ra_hir/src/ty/method_resolution.rs
@@ -16,6 +16,7 @@ use crate::{
16 resolve::Resolver, 16 resolve::Resolver,
17 ty::primitive::{FloatBitness, UncertainFloatTy, UncertainIntTy}, 17 ty::primitive::{FloatBitness, UncertainFloatTy, UncertainIntTy},
18 ty::{Ty, TypeCtor}, 18 ty::{Ty, TypeCtor},
19 type_ref::Mutability,
19 AssocItem, Crate, Function, Module, Name, Trait, 20 AssocItem, Crate, Function, Module, Name, Trait,
20}; 21};
21 22
@@ -130,7 +131,7 @@ fn def_crates(db: &impl HirDatabase, cur_crate: Crate, ty: &Ty) -> Option<ArrayV
130 ($db:expr, $cur_crate:expr, $($name:expr),+ $(,)?) => {{ 131 ($db:expr, $cur_crate:expr, $($name:expr),+ $(,)?) => {{
131 let mut v = ArrayVec::<[Crate; 2]>::new(); 132 let mut v = ArrayVec::<[Crate; 2]>::new();
132 $( 133 $(
133 v.push($db.lang_item($cur_crate, $name.into())?.krate($db)?); 134 v.extend($db.lang_item($cur_crate, $name.into()).and_then(|item| item.krate($db)));
134 )+ 135 )+
135 Some(v) 136 Some(v)
136 }}; 137 }};
@@ -149,8 +150,10 @@ fn def_crates(db: &impl HirDatabase, cur_crate: Crate, ty: &Ty) -> Option<ArrayV
149 TypeCtor::Int(UncertainIntTy::Known(i)) => { 150 TypeCtor::Int(UncertainIntTy::Known(i)) => {
150 lang_item_crate!(db, cur_crate, i.ty_to_string()) 151 lang_item_crate!(db, cur_crate, i.ty_to_string())
151 } 152 }
152 TypeCtor::Str => lang_item_crate!(db, cur_crate, "str"), 153 TypeCtor::Str => lang_item_crate!(db, cur_crate, "str_alloc", "str"),
153 TypeCtor::Slice => lang_item_crate!(db, cur_crate, "slice_alloc", "slice"), 154 TypeCtor::Slice => lang_item_crate!(db, cur_crate, "slice_alloc", "slice"),
155 TypeCtor::RawPtr(Mutability::Shared) => lang_item_crate!(db, cur_crate, "const_ptr"),
156 TypeCtor::RawPtr(Mutability::Mut) => lang_item_crate!(db, cur_crate, "mut_ptr"),
154 _ => None, 157 _ => None,
155 }, 158 },
156 _ => None, 159 _ => None,