1
Fork 0

Rollup merge of #119971 - compiler-errors:zip-eq, r=nnethercote

Use `zip_eq` to enforce that things being zipped have equal sizes

Some `zip`s are best enforced to be equal, since size mismatches suggest deeper bugs in the compiler.
This commit is contained in:
Matthias Krüger 2024-01-15 08:44:49 +01:00 committed by GitHub
commit b6f68a7fca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 35 additions and 11 deletions

View file

@ -1052,6 +1052,8 @@ fn variant_info_for_coroutine<'tcx>(
def_id: DefId,
args: ty::GenericArgsRef<'tcx>,
) -> (Vec<VariantInfo>, Option<Size>) {
use itertools::Itertools;
let Variants::Multiple { tag, ref tag_encoding, tag_field, .. } = layout.variants else {
return (vec![], None);
};
@ -1064,7 +1066,7 @@ fn variant_info_for_coroutine<'tcx>(
.as_coroutine()
.upvar_tys()
.iter()
.zip(upvar_names)
.zip_eq(upvar_names)
.enumerate()
.map(|(field_idx, (_, name))| {
let field_layout = layout.field(cx, field_idx);