diff -r c0301da04883 -r 7b2ee3e84c5f src/maputil.rs --- a/src/maputil.rs Fri Dec 06 15:30:23 2024 -0500 +++ b/src/maputil.rs Fri Dec 06 16:14:41 2024 -0500 @@ -2,6 +2,7 @@ Utilities for mapping over various container types. */ +#[cfg(feature = "nightly")] use std::mem::MaybeUninit; use itertools::izip; @@ -322,8 +323,13 @@ /// /// If `iter.next()` panicks, all items already yielded by the iterator are /// dropped. +#[cfg(feature = "nightly")] #[inline] -pub(crate) fn collect_into_array_unchecked, const N: usize>(mut iter: I) -> [T; N] +pub(crate) fn collect_into_array_unchecked< + T, + I : Iterator, + const N: usize +>(mut iter: I) -> [T; N] { if N == 0 { // SAFETY: An empty array is always inhabited and has no validity invariants. @@ -375,6 +381,19 @@ unreachable!("Something went wrong with iterator length") } +#[cfg(not(feature = "nightly"))] +#[inline] +pub(crate) fn collect_into_array_unchecked< + T, + I : Iterator, + const N: usize +>(iter: I) -> [T; N] +{ + match iter.collect::>().try_into() { + Ok(a) => a, + Err(_) => panic!("collect_into_array failure: should not happen"), + } +} #[cfg(test)] mod tests {