Auto merge of #14544 - HKalbasi:dev, r=Veykril

Infer types of nested RPITs

fix https://github.com/rust-lang/rust-analyzer/issues/14474#issuecomment-1501235394
This commit is contained in:
bors 2023-04-11 14:49:04 +00:00
commit 7afd2048f0
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> {