From 336a3c6121edf54a19728dbbd880f62bc835d7c8 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sun, 1 Mar 2020 14:31:35 +0100 Subject: Fix #3373 Basically, we need to allow variables in the caller self type to unify with the impl's declared self type. That requires some more contortions in the variable handling. I'm looking forward to (hopefully) handling this in a cleaner way when we switch to Chalk's types and unification code. --- crates/ra_hir_ty/src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'crates/ra_hir_ty/src/lib.rs') diff --git a/crates/ra_hir_ty/src/lib.rs b/crates/ra_hir_ty/src/lib.rs index 0009c426c..ca194f806 100644 --- a/crates/ra_hir_ty/src/lib.rs +++ b/crates/ra_hir_ty/src/lib.rs @@ -355,6 +355,10 @@ impl Substs { Substs(self.0[..std::cmp::min(self.0.len(), n)].into()) } + pub fn suffix(&self, n: usize) -> Substs { + Substs(self.0[self.0.len() - std::cmp::min(self.0.len(), n)..].into()) + } + pub fn as_single(&self) -> &Ty { if self.0.len() != 1 { panic!("expected substs of len 1, got {:?}", self); -- cgit v1.2.3