Closed compiler-errors closed 7 months ago
Ah, it has to do with the blanket impl I: IntoIterator :- I: Iterator
trait Iterator {
type Item;
fn next(&mut self) -> Option<Self::Item>;
}
trait IntoIterator {
type IntoIter: Iterator<Item = Self::Item>;
type Item;
}
/* Uncomment this to make it fail:
impl<I: Iterator> IntoIterator for I {
type Item = I::Item;
type IntoIter = I;
}
*/
trait DoubleEndedIterator: Iterator {
fn next_back(&mut self) -> Option<Self::Item>;
}
struct Foo<U>(U);
impl<U> Iterator for Foo<U> where U: IntoIterator {
type Item = U::Item;
fn next(&mut self) -> Option<Self::Item> { todo!() }
}
impl<U> DoubleEndedIterator for Foo<U>
where
U: IntoIterator,
<U as IntoIterator>::IntoIter: DoubleEndedIterator,
{
fn next_back(&mut self) -> Option<U::Item> {
todo!()
}
}
fn main() {}
:thinking: is this #76?
jup, it's #76
Minimized when trying to build core:
I think it's because the solver is having trouble projecting
<<U as IntoIterator>::IntoIter as Iterator>::Item
into<U as IntoIterator>::Item
. It should be possible to do that via this item boundtype IntoIter: Iterator<Item = Self::Item>
.