aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/infer
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2020-03-06 17:08:10 +0000
committerFlorian Diebold <[email protected]>2020-03-06 17:14:39 +0000
commitd17c5416af3d90b4c827224d4cd73366fa5a294b (patch)
treee67ea28da54f3ff428fdfeab1689f2a334f362a8 /crates/ra_hir_ty/src/infer
parentce7496ec2227746cfcd2147fadf58fa71f65e35b (diff)
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.
Diffstat (limited to 'crates/ra_hir_ty/src/infer')
-rw-r--r--crates/ra_hir_ty/src/infer/path.rs4
1 files changed, 2 insertions, 2 deletions
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> {
40 let ty = self.make_ty(type_ref); 40 let ty = self.make_ty(type_ref);
41 let remaining_segments_for_ty = path.segments().take(path.segments().len() - 1); 41 let remaining_segments_for_ty = path.segments().take(path.segments().len() - 1);
42 let ctx = crate::lower::TyLoweringContext::new(self.db, &resolver); 42 let ctx = crate::lower::TyLoweringContext::new(self.db, &resolver);
43 let ty = Ty::from_type_relative_path(&ctx, ty, remaining_segments_for_ty); 43 let (ty, _) = Ty::from_type_relative_path(&ctx, ty, None, remaining_segments_for_ty);
44 self.resolve_ty_assoc_item( 44 self.resolve_ty_assoc_item(
45 ty, 45 ty,
46 &path.segments().last().expect("path had at least one segment").name, 46 &path.segments().last().expect("path had at least one segment").name,
@@ -115,7 +115,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
115 let remaining_segments_for_ty = 115 let remaining_segments_for_ty =
116 remaining_segments.take(remaining_segments.len() - 1); 116 remaining_segments.take(remaining_segments.len() - 1);
117 let ctx = crate::lower::TyLoweringContext::new(self.db, &self.resolver); 117 let ctx = crate::lower::TyLoweringContext::new(self.db, &self.resolver);
118 let ty = Ty::from_partly_resolved_hir_path( 118 let (ty, _) = Ty::from_partly_resolved_hir_path(
119 &ctx, 119 &ctx,
120 def, 120 def,
121 resolved_segment, 121 resolved_segment,