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.
This commit is contained in:
Florian Diebold
2020-03-01 14:31:35 +01:00
parent 6db2da4993
commit 336a3c6121
4 changed files with 45 additions and 6 deletions

View File

@@ -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);