aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/method_resolution.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/ty/method_resolution.rs')
-rw-r--r--crates/ra_hir/src/ty/method_resolution.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/crates/ra_hir/src/ty/method_resolution.rs b/crates/ra_hir/src/ty/method_resolution.rs
index 804824868..06bfe85cd 100644
--- a/crates/ra_hir/src/ty/method_resolution.rs
+++ b/crates/ra_hir/src/ty/method_resolution.rs
@@ -10,7 +10,7 @@ use crate::{
10 HirDatabase, Module, Crate, Name, Function, Trait, 10 HirDatabase, Module, Crate, Name, Function, Trait,
11 ids::TraitId, 11 ids::TraitId,
12 impl_block::{ImplId, ImplBlock, ImplItem}, 12 impl_block::{ImplId, ImplBlock, ImplItem},
13 ty::{AdtDef, Ty}, 13 ty::{Ty, TypeName},
14 nameres::CrateModuleId, 14 nameres::CrateModuleId,
15 15
16}; 16};
@@ -18,7 +18,7 @@ use crate::{
18/// This is used as a key for indexing impls. 18/// This is used as a key for indexing impls.
19#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] 19#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
20pub enum TyFingerprint { 20pub enum TyFingerprint {
21 Adt(AdtDef), // we'll also want to index impls for primitive types etc. 21 Apply(TypeName),
22} 22}
23 23
24impl TyFingerprint { 24impl TyFingerprint {
@@ -27,7 +27,7 @@ impl TyFingerprint {
27 /// `impl &S`. Hence, this will return `None` for reference types and such. 27 /// `impl &S`. Hence, this will return `None` for reference types and such.
28 fn for_impl(ty: &Ty) -> Option<TyFingerprint> { 28 fn for_impl(ty: &Ty) -> Option<TyFingerprint> {
29 match ty { 29 match ty {
30 Ty::Adt { def_id, .. } => Some(TyFingerprint::Adt(*def_id)), 30 Ty::Apply(a_ty) => Some(TyFingerprint::Apply(a_ty.name)),
31 _ => None, 31 _ => None,
32 } 32 }
33 } 33 }
@@ -111,7 +111,10 @@ impl CrateImplBlocks {
111 111
112fn def_crate(db: &impl HirDatabase, ty: &Ty) -> Option<Crate> { 112fn def_crate(db: &impl HirDatabase, ty: &Ty) -> Option<Crate> {
113 match ty { 113 match ty {
114 Ty::Adt { def_id, .. } => def_id.krate(db), 114 Ty::Apply(a_ty) => match a_ty.name {
115 TypeName::Adt(def_id) => def_id.krate(db),
116 _ => None,
117 },
115 _ => None, 118 _ => None,
116 } 119 }
117} 120}