From 89d0ff16230a082dd6c8f3eb4330481e6db68b44 Mon Sep 17 00:00:00 2001 From: Shotaro Yamada Date: Wed, 25 Sep 2019 11:29:46 +0900 Subject: Add missing lang-items to `def_crates` --- crates/ra_hir/src/ty/method_resolution.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'crates/ra_hir/src') 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::{ 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 {{ 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 { 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, -- cgit v1.2.3