From d17c5416af3d90b4c827224d4cd73366fa5a294b Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Fri, 6 Mar 2020 18:08:10 +0100 Subject: Resolve `Self::AssocTy` in impls To do this we need to carry around the original resolution a bit, because `Self` gets resolved to the actual type immediately, but you're not allowed to write the equivalent type in a projection. (I tried just comparing the projection base type with the impl self type, but that seemed too dirty.) This is basically how rustc does it as well. Fixes #3249. --- crates/ra_hir_ty/src/infer/path.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/ra_hir_ty/src/infer/path.rs') diff --git a/crates/ra_hir_ty/src/infer/path.rs b/crates/ra_hir_ty/src/infer/path.rs index 471d60342..c733b9e1d 100644 --- a/crates/ra_hir_ty/src/infer/path.rs +++ b/crates/ra_hir_ty/src/infer/path.rs @@ -40,7 +40,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { let ty = self.make_ty(type_ref); let remaining_segments_for_ty = path.segments().take(path.segments().len() - 1); let ctx = crate::lower::TyLoweringContext::new(self.db, &resolver); - let ty = Ty::from_type_relative_path(&ctx, ty, remaining_segments_for_ty); + let (ty, _) = Ty::from_type_relative_path(&ctx, ty, None, remaining_segments_for_ty); self.resolve_ty_assoc_item( ty, &path.segments().last().expect("path had at least one segment").name, @@ -115,7 +115,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { let remaining_segments_for_ty = remaining_segments.take(remaining_segments.len() - 1); let ctx = crate::lower::TyLoweringContext::new(self.db, &self.resolver); - let ty = Ty::from_partly_resolved_hir_path( + let (ty, _) = Ty::from_partly_resolved_hir_path( &ctx, def, resolved_segment, -- cgit v1.2.3