2 #![feature(const_generics)]
3 #![allow(incomplete_features)]
5 use std::marker::PhantomData;
7 // This namespace is necessary for the ICE to trigger
11 pub fn const_chunks_exact<T, const N: usize>() -> ConstChunksExact<'static, T, N> {
12 ConstChunksExact { inner: PhantomData }
18 pub struct ConstChunksExact<'a, T, const N: usize> {
19 inner: PhantomData<&'a T>
22 impl <'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, { N }> {
23 type Item = &'a [T; N];
25 fn next(&mut self) -> Option<Self::Item> {
31 let mut chunks = Namespace::const_chunks_exact::<i32, 3usize>();
32 let _next: &[i32; 3] = chunks.next().unwrap();