Infer types of nested RPITs

This commit is contained in:
hkalbasi 2023-04-11 04:32:11 +03:30
parent 44cf8ef49a
commit a584cb998f
5 changed files with 105 additions and 34 deletions

View file

@ -891,12 +891,19 @@ pub mod iter {
self
}
}
pub struct IntoIter<T, const N: usize>([T; N]);
struct IndexRange {
start: usize,
end: usize,
}
pub struct IntoIter<T, const N: usize> {
data: [T; N],
range: IndexRange,
}
impl<T, const N: usize> IntoIterator for [T; N] {
type Item = T;
type IntoIter = IntoIter<T, N>;
fn into_iter(self) -> I {
IntoIter(self)
IntoIter { data: self, range: IndexRange { start: 0, end: self.len() } }
}
}
impl<T, const N: usize> Iterator for IntoIter<T, N> {