3 #![cfg_attr(full, feature(const_generics))]
4 #![cfg_attr(full, allow(incomplete_features))]
5 #![cfg_attr(min, feature(min_const_generics))]
7 use std::marker::PhantomData;
9 // This namespace is necessary for the ICE to trigger
13 pub fn const_chunks_exact<T, const N: usize>() -> ConstChunksExact<'static, T, N> {
14 ConstChunksExact { inner: PhantomData }
20 pub struct ConstChunksExact<'a, T, const N: usize> {
21 inner: PhantomData<&'a T>
24 impl <'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, { N }> {
25 type Item = &'a [T; N];
27 fn next(&mut self) -> Option<Self::Item> {
33 let mut chunks = Namespace::const_chunks_exact::<i32, 3usize>();
34 let _next: &[i32; 3] = chunks.next().unwrap();