Skip to content

Commit be2c8f2

Browse files
committed
Update zip for better codegen, see discussion
1 parent 2f35fb1 commit be2c8f2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

library/core/src/array/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -481,8 +481,8 @@ impl<T, const N: usize> [T; N] {
481481
use crate::mem::MaybeUninit;
482482

483483
let mut dst = MaybeUninit::uninit_array::<N>();
484-
for ((lhs, rhs), dst) in IntoIter::new(self).zip(IntoIter::new(rhs)).zip(&mut dst) {
485-
dst.write((lhs, rhs));
484+
for (i, (lhs, rhs)) in IntoIter::new(self).zip(IntoIter::new(rhs)).enumerate() {
485+
dst[i].write((lhs, rhs));
486486
}
487487
// FIXME: Convert to crate::mem::transmute once it works with generics.
488488
// unsafe { crate::mem::transmute::<[MaybeUninit<U>; N], [U; N]>(dst) }

0 commit comments

Comments
 (0)