Fix overflow in type checking of tuple patterns

This commit is contained in:
Vadim Petrochenkov 2016-03-06 15:54:44 +03:00
parent 35ef09c38b
commit 0ca9bf3940

View File

@ -275,7 +275,7 @@ pub fn check_pat(&self, pat: &'gcx hir::Pat, expected: Ty<'tcx>) {
let pat_ty = tcx.mk_tup(element_tys.clone()); let pat_ty = tcx.mk_tup(element_tys.clone());
self.write_ty(pat.id, pat_ty); self.write_ty(pat.id, pat_ty);
self.demand_eqtype(pat.span, expected, pat_ty); self.demand_eqtype(pat.span, expected, pat_ty);
for (i, elem) in elements.iter().enumerate_and_adjust(expected_len, ddpos) { for (i, elem) in elements.iter().enumerate_and_adjust(max_len, ddpos) {
self.check_pat(elem, &element_tys[i]); self.check_pat(elem, &element_tys[i]);
} }
} }