]> git.lizzy.rs Git - rust.git/commit - src/tools/miri
Rollup merge of #91341 - scottmcm:array-iter-frp, r=kennytm
authorMatthias Krüger <matthias.krueger@famsik.de>
Tue, 7 Dec 2021 10:04:59 +0000 (11:04 +0100)
committerGitHub <noreply@github.com>
Tue, 7 Dec 2021 10:04:59 +0000 (11:04 +0100)
commit677f878e36e6b089c3213063508ec6b11c340a1f
treef4ab272b0f52cc8402b95fd339df7c2dadb2a949
parent57ae43d1f2f6053eebbf85313b418a8191d6e575
parent9b86c5998c5b5b274b21651334a320aecc516dfc
Rollup merge of #91341 - scottmcm:array-iter-frp, r=kennytm

Add `array::IntoIter::{empty, from_raw_parts}`

`array::IntoIter` has a bunch of really handy logic for dealing with partial arrays, but it's currently hamstrung by only being creatable from a fully-initialized array.

This PR adds two new constructors:
- a safe & const `empty`, since `[].into_iter()` can only give `IntoIter<T, 0>`, not `IntoIter<T, N>`.
- an unsafe `from_raw_parts`, to allow experimentation with new uses.

(Slice & vec iterators don't need `from_raw_parts` because you `from_raw_parts` the slice or vec instead, but there's no useful way to made a `<[T; N]>::from_raw_parts`, so I think this is a reasonable place to have one.)