diff options
Diffstat (limited to 'crates/ra_hir/src/ty/method_resolution.rs')
-rw-r--r-- | crates/ra_hir/src/ty/method_resolution.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/crates/ra_hir/src/ty/method_resolution.rs b/crates/ra_hir/src/ty/method_resolution.rs index 770e1964e..40f5eabf0 100644 --- a/crates/ra_hir/src/ty/method_resolution.rs +++ b/crates/ra_hir/src/ty/method_resolution.rs | |||
@@ -7,7 +7,7 @@ use std::sync::Arc; | |||
7 | use arrayvec::ArrayVec; | 7 | use arrayvec::ArrayVec; |
8 | use rustc_hash::FxHashMap; | 8 | use rustc_hash::FxHashMap; |
9 | 9 | ||
10 | use super::{autoderef, Canonical, Environment, InEnvironment, TraitRef}; | 10 | use super::{autoderef, lower, Canonical, Environment, InEnvironment, TraitRef}; |
11 | use crate::{ | 11 | use crate::{ |
12 | generics::HasGenericParams, | 12 | generics::HasGenericParams, |
13 | impl_block::{ImplBlock, ImplId, ImplItem}, | 13 | impl_block::{ImplBlock, ImplId, ImplItem}, |
@@ -198,6 +198,8 @@ fn iterate_trait_method_candidates<T>( | |||
198 | mut callback: impl FnMut(&Ty, Function) -> Option<T>, | 198 | mut callback: impl FnMut(&Ty, Function) -> Option<T>, |
199 | ) -> Option<T> { | 199 | ) -> Option<T> { |
200 | let krate = resolver.krate()?; | 200 | let krate = resolver.krate()?; |
201 | // FIXME: maybe put the trait_env behind a query (need to figure out good input parameters for that) | ||
202 | let env = lower::trait_env(db, resolver); | ||
201 | 'traits: for t in resolver.traits_in_scope(db) { | 203 | 'traits: for t in resolver.traits_in_scope(db) { |
202 | let data = t.trait_data(db); | 204 | let data = t.trait_data(db); |
203 | // we'll be lazy about checking whether the type implements the | 205 | // we'll be lazy about checking whether the type implements the |
@@ -209,8 +211,7 @@ fn iterate_trait_method_candidates<T>( | |||
209 | let data = m.data(db); | 211 | let data = m.data(db); |
210 | if name.map_or(true, |name| data.name() == name) && data.has_self_param() { | 212 | if name.map_or(true, |name| data.name() == name) && data.has_self_param() { |
211 | if !known_implemented { | 213 | if !known_implemented { |
212 | let env = Arc::new(super::Environment); // FIXME add environment | 214 | let trait_ref = canonical_trait_ref(db, env.clone(), t, ty.clone()); |
213 | let trait_ref = canonical_trait_ref(db, env, t, ty.clone()); | ||
214 | if db.implements(krate, trait_ref).is_none() { | 215 | if db.implements(krate, trait_ref).is_none() { |
215 | continue 'traits; | 216 | continue 'traits; |
216 | } | 217 | } |