Support "for loop" MIR lowering

This commit is contained in:
hkalbasi 2023-03-02 11:18:50 +03:30
parent ac04bfd7a7
commit 6377d50bd1
8 changed files with 292 additions and 79 deletions

View file

@ -728,6 +728,20 @@ pub mod iter {
self
}
}
pub struct IntoIter<T, const N: usize>([T; N]);
impl<T, const N: usize> IntoIterator for [T; N] {
type Item = T;
type IntoIter = IntoIter<T, N>;
fn into_iter(self) -> I {
IntoIter(self)
}
}
impl<T, const N: usize> Iterator for IntoIter<T, N> {
type Item = T;
fn next(&mut self) -> Option<T> {
loop {}
}
}
}
pub use self::collect::IntoIterator;
}