]>
Commit | Line | Data |
---|---|---|
487cf647 FG |
1 | // check-pass |
2 | #![crate_type = "lib"] | |
3 | #![feature(generic_const_exprs)] | |
4 | #![allow(incomplete_features)] | |
5 | pub trait MyIterator { | |
6 | type Output; | |
7 | } | |
8 | ||
9 | pub trait Foo { | |
10 | const ABC: usize; | |
11 | } | |
12 | ||
13 | pub struct IteratorStruct<const N: usize>{ | |
14 | ||
15 | } | |
16 | ||
17 | pub struct Bar<const N: usize> { | |
18 | pub data: [usize; N] | |
19 | } | |
20 | ||
21 | impl<const N: usize> MyIterator for IteratorStruct<N> { | |
22 | type Output = Bar<N>; | |
23 | } | |
24 | ||
25 | pub fn test1<T: Foo>() -> impl MyIterator<Output = Bar<{T::ABC}>> where [(); T::ABC]: Sized { | |
26 | IteratorStruct::<{T::ABC}>{} | |
27 | } | |
28 | ||
29 | pub trait Baz<const N: usize>{} | |
30 | impl<const N: usize> Baz<N> for Bar<N> {} | |
31 | pub fn test2<T: Foo>() -> impl MyIterator<Output = impl Baz<{ T::ABC }>> where [(); T::ABC]: Sized { | |
32 | IteratorStruct::<{T::ABC}>{} | |
33 | } |