1
Fork 0

Use zip_eq to enforce that things being zipped have equal sizes

This commit is contained in:
Michael Goulet 2024-01-14 20:01:12 +00:00
parent c5cb87cf0c
commit c811662fb0
11 changed files with 33 additions and 10 deletions

View file

@ -836,7 +836,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
self.upvars = tcx
.closure_captures(self.def_id)
.iter()
.zip(capture_tys)
.zip_eq(capture_tys)
.enumerate()
.map(|(i, (captured_place, ty))| {
let name = captured_place.to_symbol();

View file

@ -2,6 +2,7 @@ use crate::errors;
use crate::thir::cx::region::Scope;
use crate::thir::cx::Cx;
use crate::thir::util::UserAnnotatedTyHelpers;
use itertools::Itertools;
use rustc_data_structures::stack::ensure_sufficient_stack;
use rustc_hir as hir;
use rustc_hir::def::{CtorKind, CtorOf, DefKind, Res};
@ -565,7 +566,7 @@ impl<'tcx> Cx<'tcx> {
.tcx
.closure_captures(def_id)
.iter()
.zip(args.upvar_tys())
.zip_eq(args.upvar_tys())
.map(|(captured_place, ty)| {
let upvars = self.capture_upvar(expr, captured_place, ty);
self.thir.exprs.push(upvars)