Skip to content

Commit eee160c

Browse files
committed
add regression test for rust-lang#70586
1 parent 137ca05 commit eee160c

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// check-pass
2+
#![feature(const_generics)]
3+
#![allow(incomplete_features)]
4+
5+
use std::marker::PhantomData;
6+
7+
// This namespace is necessary for the ICE to trigger
8+
struct Namespace;
9+
10+
impl Namespace {
11+
pub fn const_chunks_exact<T, const N: usize>() -> ConstChunksExact<'static, T, N> {
12+
ConstChunksExact { inner: PhantomData }
13+
}
14+
}
15+
16+
17+
#[derive(Debug)]
18+
pub struct ConstChunksExact<'a, T, const N: usize> {
19+
inner: PhantomData<&'a T>
20+
}
21+
22+
impl <'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, { N }> {
23+
type Item = &'a [T; N];
24+
25+
fn next(&mut self) -> Option<Self::Item> {
26+
unreachable!()
27+
}
28+
}
29+
30+
fn main() {
31+
let mut chunks = Namespace::const_chunks_exact::<i32, 3usize>();
32+
let _next: &[i32; 3] = chunks.next().unwrap();
33+
}

0 commit comments

Comments
 (0)