summary refs log tree commit diff
path: root/compiler/rustc_ty_utils/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-01-15 08:44:49 +0100
committerGitHub <noreply@github.com>2024-01-15 08:44:49 +0100
commitb6f68a7fca2cd2172a8be6a7eaf3a0d5941819f8 (patch)
tree21b0f38e656f733dcd2d6ff2953bbacf2132752d /compiler/rustc_ty_utils/src
parent0891cb4d814b4acb0b65fc0e73c710f7f38e9741 (diff)
parentc811662fb0e3eab4ee88134551cf2605327705f6 (diff)
downloadrust-b6f68a7fca2cd2172a8be6a7eaf3a0d5941819f8.tar.gz
rust-b6f68a7fca2cd2172a8be6a7eaf3a0d5941819f8.zip
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.
Diffstat (limited to 'compiler/rustc_ty_utils/src')
-rw-r--r--compiler/rustc_ty_utils/src/layout.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_ty_utils/src/layout.rs b/compiler/rustc_ty_utils/src/layout.rs
index b8351463c55..2fc4bfd4aa3 100644
--- a/compiler/rustc_ty_utils/src/layout.rs
+++ b/compiler/rustc_ty_utils/src/layout.rs
@@ -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);