Closed
Description
Implementing a trait that requires an iterator trait on a struct without implementing the iterator itself leads to an irrelevant error message.
fn main() {}
trait A: Iterator<Item=i32> {}
struct B {}
impl A for B {}
Error message:
error[E0277]: the trait bound `B: std::iter::Iterator` is not satisfied
--> src/main.rs:6:6
|
6 | impl A for B {}
| ^ `B` is not an iterator; maybe try calling `.iter()` or a similar method
|
= help: the trait `std::iter::Iterator` is not implemented for `B`
Actually implementing the iterator fixes the error.
I tried it on the Rust Playground, so I should have used the newest versions: https://play.rust-lang.org/?version=stable&mode=debug&edition=2015&gist=a5a597c2a8d0fa4769ff30dca58443c0 . I ran it on all three channels.