| 320 /// `next` at most `N` times, the iterator can still be used afterwards to |
321 /// `next` at most `N` times, the iterator can still be used afterwards to |
| 321 /// retrieve the remaining items. |
322 /// retrieve the remaining items. |
| 322 /// |
323 /// |
| 323 /// If `iter.next()` panicks, all items already yielded by the iterator are |
324 /// If `iter.next()` panicks, all items already yielded by the iterator are |
| 324 /// dropped. |
325 /// dropped. |
| |
326 #[cfg(feature = "nightly")] |
| 325 #[inline] |
327 #[inline] |
| 326 pub(crate) fn collect_into_array_unchecked<T, I : Iterator<Item=T>, const N: usize>(mut iter: I) -> [T; N] |
328 pub(crate) fn collect_into_array_unchecked< |
| |
329 T, |
| |
330 I : Iterator<Item=T>, |
| |
331 const N: usize |
| |
332 >(mut iter: I) -> [T; N] |
| 327 { |
333 { |
| 328 if N == 0 { |
334 if N == 0 { |
| 329 // SAFETY: An empty array is always inhabited and has no validity invariants. |
335 // SAFETY: An empty array is always inhabited and has no validity invariants. |
| 330 return unsafe { core::mem::zeroed() }; |
336 return unsafe { core::mem::zeroed() }; |
| 331 } |
337 } |