Skip to content

Commit a9e5f5c

Browse files
authored
Rollup merge of #112096 - workingjubilee:array-unzip, r=scottmcm
Remove array_zip `[T; N]::zip` is "eager" but most zips are mapped. This causes poor optimization in generated code. This is a fundamental design issue and "zip" is "prime real estate" in terms of function names, so let's free it up again. - FCP concluded in rust-lang/rust#80094 (comment) - Closes rust-lang/rust#80094 - Closes rust-lang/rust#103555 Could use review to make sure we aren't losing any essential codegen tests. r? `@scottmcm`
2 parents beac94e + ffe677f commit a9e5f5c

File tree

1 file changed

+0
-23
lines changed

1 file changed

+0
-23
lines changed

core/src/array/mod.rs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -538,29 +538,6 @@ impl<T, const N: usize> [T; N] {
538538
drain_array_with(self, |iter| try_from_trusted_iterator(iter.map(f)))
539539
}
540540

541-
/// 'Zips up' two arrays into a single array of pairs.
542-
///
543-
/// `zip()` returns a new array where every element is a tuple where the
544-
/// first element comes from the first array, and the second element comes
545-
/// from the second array. In other words, it zips two arrays together,
546-
/// into a single one.
547-
///
548-
/// # Examples
549-
///
550-
/// ```
551-
/// #![feature(array_zip)]
552-
/// let x = [1, 2, 3];
553-
/// let y = [4, 5, 6];
554-
/// let z = x.zip(y);
555-
/// assert_eq!(z, [(1, 4), (2, 5), (3, 6)]);
556-
/// ```
557-
#[unstable(feature = "array_zip", issue = "80094")]
558-
pub fn zip<U>(self, rhs: [U; N]) -> [(T, U); N] {
559-
drain_array_with(self, |lhs| {
560-
drain_array_with(rhs, |rhs| from_trusted_iterator(crate::iter::zip(lhs, rhs)))
561-
})
562-
}
563-
564541
/// Returns a slice containing the entire array. Equivalent to `&s[..]`.
565542
#[stable(feature = "array_as_slice", since = "1.57.0")]
566543
#[rustc_const_stable(feature = "array_as_slice", since = "1.57.0")]

0 commit comments

Comments
 (0)