Fix wrong substitution code

We need to shift in when we're substituting inside a binder.

This should fix #4053 (it doesn't fix the occasional overflow that also occurs
on the Diesel codebase though).
This commit is contained in:
Florian Diebold
2020-04-23 20:50:14 +02:00
parent 29bc218fba
commit 0c01b4eb6a
2 changed files with 42 additions and 1 deletions

View File

@@ -863,7 +863,7 @@ pub trait TypeWalk {
&mut |ty, binders| {
if let &mut Ty::Bound(bound) = ty {
if bound.debruijn >= binders {
*ty = substs.0[bound.index].clone();
*ty = substs.0[bound.index].clone().shift_bound_vars(binders);
}
}
},