This is a striped down version of an error I recently stumbled into:
struct Foo<T>(T);
impl<'a, T> IntoIterator for &'a Foo<T> where &'a T: IntoIterator {
type Item = <&'a T as IntoIterator>::Item;
type IntoIter = <&'a T as IntoIterator>::IntoIter;
fn into_iter(self) -> Self::IntoIter {
self.0.into_iter()
}
}
fn main() {
for _ in Foo([]) {}
}
Errors:
Compiling playground v0.0.1 (/playground)
error[E0275]: overflow evaluating the requirement `&_: IntoIterator`
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`playground`)
note: required for `&Foo<_>` to implement `IntoIterator`
--> src/main.rs:3:13
|
3 | impl<'a, T> IntoIterator for &'a Foo<T> where &'a T: IntoIterator {
| ^^^^^^^^^^^^ ^^^^^^^^^^ ------------ unsatisfied trait bound introduced here
= note: 126 redundant requirements hidden
= note: required for `&Foo<Foo<Foo<Foo<Foo<Foo<Foo<Foo<Foo<Foo<Foo<Foo<Foo<Foo<Foo<Foo<Foo<Foo<Foo<Foo<Foo<...>>>>>>>>>>>>>>>>>>>>>` to implement `IntoIterator`
= note: the full name for the type has been written to '/playground/target/debug/deps/playground-cd56f89b016b72c1.long-type-5180598437654316909.txt'
= note: consider using `--verbose` to print the full type name to the console
For more information about this error, try `rustc --explain E0275`.
error: could not compile `playground` (bin "playground") due to 1 previous error
I would have wished to be informed about Iterator
not being implemented for Foo
itself. Nevertheless, providing IntoIter
for Foo
and trying to iterate &Foo([])
instead seems to behave as expected.
This might be a bug and I was wondering if and where I should report it.