diff options
author | Seivan Heidari <[email protected]> | 2019-11-14 22:20:27 +0000 |
---|---|---|
committer | Seivan Heidari <[email protected]> | 2019-11-14 22:20:27 +0000 |
commit | c622413bc72ea56d5f62a16788d897cb61eca948 (patch) | |
tree | 9de3dbe8b5c935ed168efac4e70770e54fbe0714 /crates/ra_hir/src/ty/method_resolution.rs | |
parent | 0525778a3ad590492b51cc11085d815f9bb8f92b (diff) | |
parent | bbb022d3999b3038549ec6c309efb065231c896a (diff) |
Merge branch 'master' of https://github.com/rust-analyzer/rust-analyzer into feature/themes
Diffstat (limited to 'crates/ra_hir/src/ty/method_resolution.rs')
-rw-r--r-- | crates/ra_hir/src/ty/method_resolution.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/crates/ra_hir/src/ty/method_resolution.rs b/crates/ra_hir/src/ty/method_resolution.rs index 8c3d32d09..eb5ca6769 100644 --- a/crates/ra_hir/src/ty/method_resolution.rs +++ b/crates/ra_hir/src/ty/method_resolution.rs | |||
@@ -8,16 +8,17 @@ use arrayvec::ArrayVec; | |||
8 | use hir_def::CrateModuleId; | 8 | use hir_def::CrateModuleId; |
9 | use rustc_hash::FxHashMap; | 9 | use rustc_hash::FxHashMap; |
10 | 10 | ||
11 | use super::{autoderef, lower, Canonical, InEnvironment, TraitEnvironment, TraitRef}; | ||
12 | use crate::{ | 11 | use crate::{ |
13 | db::HirDatabase, | 12 | db::HirDatabase, |
14 | impl_block::{ImplBlock, ImplId}, | 13 | impl_block::{ImplBlock, ImplId}, |
15 | resolve::Resolver, | 14 | resolve::Resolver, |
16 | ty::primitive::{FloatBitness, UncertainFloatTy, UncertainIntTy}, | 15 | ty::primitive::{FloatBitness, Uncertain}, |
17 | ty::{Ty, TypeCtor}, | 16 | ty::{Ty, TypeCtor}, |
18 | AssocItem, Crate, Function, Module, Mutability, Name, Trait, | 17 | AssocItem, Crate, Function, Module, Mutability, Name, Trait, |
19 | }; | 18 | }; |
20 | 19 | ||
20 | use super::{autoderef, lower, Canonical, InEnvironment, TraitEnvironment, TraitRef}; | ||
21 | |||
21 | /// This is used as a key for indexing impls. | 22 | /// This is used as a key for indexing impls. |
22 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] | 23 | #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] |
23 | pub enum TyFingerprint { | 24 | pub enum TyFingerprint { |
@@ -140,14 +141,12 @@ fn def_crates(db: &impl HirDatabase, cur_crate: Crate, ty: &Ty) -> Option<ArrayV | |||
140 | TypeCtor::Adt(def_id) => Some(std::iter::once(def_id.krate(db)?).collect()), | 141 | TypeCtor::Adt(def_id) => Some(std::iter::once(def_id.krate(db)?).collect()), |
141 | TypeCtor::Bool => lang_item_crate!(db, cur_crate, "bool"), | 142 | TypeCtor::Bool => lang_item_crate!(db, cur_crate, "bool"), |
142 | TypeCtor::Char => lang_item_crate!(db, cur_crate, "char"), | 143 | TypeCtor::Char => lang_item_crate!(db, cur_crate, "char"), |
143 | TypeCtor::Float(UncertainFloatTy::Known(f)) => match f.bitness { | 144 | TypeCtor::Float(Uncertain::Known(f)) => match f.bitness { |
144 | // There are two lang items: one in libcore (fXX) and one in libstd (fXX_runtime) | 145 | // There are two lang items: one in libcore (fXX) and one in libstd (fXX_runtime) |
145 | FloatBitness::X32 => lang_item_crate!(db, cur_crate, "f32", "f32_runtime"), | 146 | FloatBitness::X32 => lang_item_crate!(db, cur_crate, "f32", "f32_runtime"), |
146 | FloatBitness::X64 => lang_item_crate!(db, cur_crate, "f64", "f64_runtime"), | 147 | FloatBitness::X64 => lang_item_crate!(db, cur_crate, "f64", "f64_runtime"), |
147 | }, | 148 | }, |
148 | TypeCtor::Int(UncertainIntTy::Known(i)) => { | 149 | TypeCtor::Int(Uncertain::Known(i)) => lang_item_crate!(db, cur_crate, i.ty_to_string()), |
149 | lang_item_crate!(db, cur_crate, i.ty_to_string()) | ||
150 | } | ||
151 | TypeCtor::Str => lang_item_crate!(db, cur_crate, "str_alloc", "str"), | 150 | TypeCtor::Str => lang_item_crate!(db, cur_crate, "str_alloc", "str"), |
152 | TypeCtor::Slice => lang_item_crate!(db, cur_crate, "slice_alloc", "slice"), | 151 | TypeCtor::Slice => lang_item_crate!(db, cur_crate, "slice_alloc", "slice"), |
153 | TypeCtor::RawPtr(Mutability::Shared) => lang_item_crate!(db, cur_crate, "const_ptr"), | 152 | TypeCtor::RawPtr(Mutability::Shared) => lang_item_crate!(db, cur_crate, "const_ptr"), |