diff options
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r-- | crates/ra_hir/src/ty/method_resolution.rs | 7 |
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, |