diff options
| author | bors <bors@rust-lang.org> | 2025-04-11 23:21:31 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-04-11 23:21:31 +0000 |
| commit | 1bc56185ee257ed829a0aea7abdc3b03c5fed887 (patch) | |
| tree | 673d48e93f27bfde96220bdbd7261bf44b576517 /library/std/src/sys/mod.rs | |
| parent | d2b3dd7c173de58881ead8109f7970b9cd926e2a (diff) | |
| parent | 4207c786e752ed7495782c39b74917bbcaf438cf (diff) | |
| download | rust-1bc56185ee257ed829a0aea7abdc3b03c5fed887.tar.gz rust-1bc56185ee257ed829a0aea7abdc3b03c5fed887.zip | |
Auto merge of #139430 - scottmcm:polymorphic-array-into-iter, r=cuviper
Polymorphize `array::IntoIter`'s iterator impl Today we emit all the iterator methods for every different array width. That's wasteful since the actual array length never even comes into it -- the indices used are from the separate `alive: IndexRange` field, not even the `N` const param. This PR switches things so that an `array::IntoIter<T, N>` stores a `PolymorphicIter<[MaybeUninit<T>; N]>`, which we *unsize* to `PolymorphicIter<[MaybeUninit<T>]>` and call methods on that non-`Sized` type for all the iterator methods. That also necessarily makes the layout consistent between the different lengths of arrays, because of the unsizing. Compare that to today <https://rust.godbolt.org/z/Prb4xMPrb>, where different widths can't even be deduped because the offset to the indices is different for different array widths.
Diffstat (limited to 'library/std/src/sys/mod.rs')
0 files changed, 0 insertions, 0 deletions
