diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-09-25 09:55:32 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2019-09-25 09:55:32 +0100 |
commit | 63433ba79abc84754172a715f37bd53596f6848e (patch) | |
tree | 867d5cda3e0befea6cc700a53c21663bb1fa9838 /crates/ra_hir/src | |
parent | 6bac2d0a637a6d0b3922a6f8fe05fa32d6d43b15 (diff) | |
parent | 89d0ff16230a082dd6c8f3eb4330481e6db68b44 (diff) |
Merge #1906
1906: Add missing lang-items to `def_crates` r=matklad a=sinkuu
Co-authored-by: Shotaro Yamada <[email protected]>
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 a967d8a7f..4b71b376f 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, |