diff options
| author | Jubilee Young <workingjubilee@gmail.com> | 2023-05-30 00:34:50 -0700 |
|---|---|---|
| committer | Jubilee Young <workingjubilee@gmail.com> | 2023-05-30 00:40:39 -0700 |
| commit | 472230d192b8bace6ddbe825d68ccd27d0d5ef1d (patch) | |
| tree | a4f10140d7833692e52bf4425f417fdff61ca256 /library/core/src/array | |
| parent | 165cddafe9449e090fdef2686045385b55a87329 (diff) | |
| download | rust-472230d192b8bace6ddbe825d68ccd27d0d5ef1d.tar.gz rust-472230d192b8bace6ddbe825d68ccd27d0d5ef1d.zip | |
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.
Diffstat (limited to 'library/core/src/array')
| -rw-r--r-- | library/core/src/array/mod.rs | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/library/core/src/array/mod.rs b/library/core/src/array/mod.rs index fec92320a4b..76b3589b9e4 100644 --- a/library/core/src/array/mod.rs +++ b/library/core/src/array/mod.rs @@ -538,29 +538,6 @@ impl<T, const N: usize> [T; N] { drain_array_with(self, |iter| try_from_trusted_iterator(iter.map(f))) } - /// 'Zips up' two arrays into a single array of pairs. - /// - /// `zip()` returns a new array where every element is a tuple where the - /// first element comes from the first array, and the second element comes - /// from the second array. In other words, it zips two arrays together, - /// into a single one. - /// - /// # Examples - /// - /// ``` - /// #![feature(array_zip)] - /// let x = [1, 2, 3]; - /// let y = [4, 5, 6]; - /// let z = x.zip(y); - /// assert_eq!(z, [(1, 4), (2, 5), (3, 6)]); - /// ``` - #[unstable(feature = "array_zip", issue = "80094")] - pub fn zip<U>(self, rhs: [U; N]) -> [(T, U); N] { - drain_array_with(self, |lhs| { - drain_array_with(rhs, |rhs| from_trusted_iterator(crate::iter::zip(lhs, rhs))) - }) - } - /// Returns a slice containing the entire array. Equivalent to `&s[..]`. #[stable(feature = "array_as_slice", since = "1.57.0")] #[rustc_const_stable(feature = "array_as_slice", since = "1.57.0")] |
