diff options
Diffstat (limited to 'crates/ra_hir_ty/src/infer/path.rs')
-rw-r--r-- | crates/ra_hir_ty/src/infer/path.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/crates/ra_hir_ty/src/infer/path.rs b/crates/ra_hir_ty/src/infer/path.rs index e6676e1aa..14be66836 100644 --- a/crates/ra_hir_ty/src/infer/path.rs +++ b/crates/ra_hir_ty/src/infer/path.rs | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | use hir_def::{ | 3 | use hir_def::{ |
4 | path::{Path, PathKind, PathSegment}, | 4 | path::{Path, PathKind, PathSegment}, |
5 | resolver::{HasResolver, ResolveValueResult, Resolver, TypeNs, ValueNs}, | 5 | resolver::{ResolveValueResult, Resolver, TypeNs, ValueNs}, |
6 | AssocItemId, ContainerId, Lookup, | 6 | AssocItemId, ContainerId, Lookup, |
7 | }; | 7 | }; |
8 | use hir_expand::name::Name; | 8 | use hir_expand::name::Name; |
@@ -244,17 +244,15 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
244 | ContainerId::ImplId(it) => it, | 244 | ContainerId::ImplId(it) => it, |
245 | _ => return None, | 245 | _ => return None, |
246 | }; | 246 | }; |
247 | let resolver = impl_id.resolver(self.db); | 247 | let self_ty = self.db.impl_ty(impl_id).self_type().clone(); |
248 | let impl_data = self.db.impl_data(impl_id); | 248 | let self_ty_substs = self_ty.substs()?; |
249 | let impl_block = Ty::from_hir(self.db, &resolver, &impl_data.target_type); | ||
250 | let impl_block_substs = impl_block.substs()?; | ||
251 | let actual_substs = actual_def_ty.substs()?; | 249 | let actual_substs = actual_def_ty.substs()?; |
252 | 250 | ||
253 | let mut new_substs = vec![Ty::Unknown; gen.count_parent_params()]; | 251 | let mut new_substs = vec![Ty::Unknown; gen.count_parent_params()]; |
254 | 252 | ||
255 | // The following code *link up* the function actual parma type | 253 | // The following code *link up* the function actual parma type |
256 | // and impl_block type param index | 254 | // and impl_block type param index |
257 | impl_block_substs.iter().zip(actual_substs.iter()).for_each(|(param, pty)| { | 255 | self_ty_substs.iter().zip(actual_substs.iter()).for_each(|(param, pty)| { |
258 | if let Ty::Param { idx, .. } = param { | 256 | if let Ty::Param { idx, .. } = param { |
259 | if let Some(s) = new_substs.get_mut(*idx as usize) { | 257 | if let Some(s) = new_substs.get_mut(*idx as usize) { |
260 | *s = pty.clone(); | 258 | *s = pty.clone(); |