diff options
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r-- | crates/ra_hir/src/lib.rs | 3 | ||||
-rw-r--r-- | crates/ra_hir/src/source_binder.rs | 8 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/method_resolution.rs | 2 |
3 files changed, 8 insertions, 5 deletions
diff --git a/crates/ra_hir/src/lib.rs b/crates/ra_hir/src/lib.rs index 40f5562b4..4cace432e 100644 --- a/crates/ra_hir/src/lib.rs +++ b/crates/ra_hir/src/lib.rs | |||
@@ -76,7 +76,8 @@ pub use crate::{ | |||
76 | resolve::ScopeDef, | 76 | resolve::ScopeDef, |
77 | source_binder::{PathResolution, ScopeEntryWithSyntax, SourceAnalyzer}, | 77 | source_binder::{PathResolution, ScopeEntryWithSyntax, SourceAnalyzer}, |
78 | ty::{ | 78 | ty::{ |
79 | display::HirDisplay, ApplicationTy, CallableDef, Substs, TraitRef, Ty, TypeCtor, TypeWalk, | 79 | display::HirDisplay, method_resolution::LookupMode, ApplicationTy, CallableDef, Substs, |
80 | TraitRef, Ty, TypeCtor, TypeWalk, | ||
80 | }, | 81 | }, |
81 | }; | 82 | }; |
82 | 83 | ||
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs index 0398806fd..82e6eb852 100644 --- a/crates/ra_hir/src/source_binder.rs +++ b/crates/ra_hir/src/source_binder.rs | |||
@@ -27,7 +27,7 @@ use crate::{ | |||
27 | }, | 27 | }, |
28 | ids::LocationCtx, | 28 | ids::LocationCtx, |
29 | resolve::{ScopeDef, TypeNs, ValueNs}, | 29 | resolve::{ScopeDef, TypeNs, ValueNs}, |
30 | ty::method_resolution::implements_trait, | 30 | ty::method_resolution::{self, implements_trait}, |
31 | AssocItem, Const, DefWithBody, Either, Enum, FromSource, Function, HasBody, HirFileId, | 31 | AssocItem, Const, DefWithBody, Either, Enum, FromSource, Function, HasBody, HirFileId, |
32 | MacroDef, Module, Name, Path, Resolver, Static, Struct, Ty, | 32 | MacroDef, Module, Name, Path, Resolver, Static, Struct, Ty, |
33 | }; | 33 | }; |
@@ -327,17 +327,19 @@ impl SourceAnalyzer { | |||
327 | db: &impl HirDatabase, | 327 | db: &impl HirDatabase, |
328 | ty: Ty, | 328 | ty: Ty, |
329 | name: Option<&Name>, | 329 | name: Option<&Name>, |
330 | mode: method_resolution::LookupMode, | ||
330 | callback: impl FnMut(&Ty, AssocItem) -> Option<T>, | 331 | callback: impl FnMut(&Ty, AssocItem) -> Option<T>, |
331 | ) -> Option<T> { | 332 | ) -> Option<T> { |
332 | // There should be no inference vars in types passed here | 333 | // There should be no inference vars in types passed here |
333 | // FIXME check that? | 334 | // FIXME check that? |
335 | // FIXME replace Unknown by bound vars here | ||
334 | let canonical = crate::ty::Canonical { value: ty, num_vars: 0 }; | 336 | let canonical = crate::ty::Canonical { value: ty, num_vars: 0 }; |
335 | crate::ty::method_resolution::iterate_method_candidates( | 337 | method_resolution::iterate_method_candidates( |
336 | &canonical, | 338 | &canonical, |
337 | db, | 339 | db, |
338 | &self.resolver, | 340 | &self.resolver, |
339 | name, | 341 | name, |
340 | crate::ty::method_resolution::LookupMode::MethodCall, | 342 | mode, |
341 | callback, | 343 | callback, |
342 | ) | 344 | ) |
343 | } | 345 | } |
diff --git a/crates/ra_hir/src/ty/method_resolution.rs b/crates/ra_hir/src/ty/method_resolution.rs index 43b485ec0..9caff422f 100644 --- a/crates/ra_hir/src/ty/method_resolution.rs +++ b/crates/ra_hir/src/ty/method_resolution.rs | |||
@@ -176,7 +176,7 @@ pub(crate) fn lookup_method( | |||
176 | } | 176 | } |
177 | 177 | ||
178 | #[derive(Copy, Clone, Debug, PartialEq, Eq)] | 178 | #[derive(Copy, Clone, Debug, PartialEq, Eq)] |
179 | pub(crate) enum LookupMode { | 179 | pub enum LookupMode { |
180 | MethodCall, | 180 | MethodCall, |
181 | Path, | 181 | Path, |
182 | } | 182 | } |