Open
Description
Code
pub struct Foo<I>
where I: Iterator,
{
iter: I,
}
pub trait Bar: Iterator + Sized {
fn sprawl(self) -> Foo<Self> {
Foo {
iter: self
}
}
}
impl<T> Bar for Vec<T>
where
T: Iterator,
{}
It suggests you to call `iter()` on `Vec<T>` in the impl, which is invalid code
Current output
Error[E0277]: `Vec<T>` is not an iterator
--> src/lib.rs:17:19
|
17 | impl<T> Bar for Vec<T>
| ^^^^^^ `Vec<T>` is not an iterator; try calling `.into_iter()` or `.iter()`
|
= help: the trait `Iterator` is not implemented for `Vec<T>`
note: required by a bound in `Bar`
--> src/lib.rs:9:18
|
9 | pub trait Bar: Iterator + Sized {
| ^^^^^^^^ required by this bound in `Bar`
For more information about this error, try `rustc --explain E0277`.
Rationale and extra context
Rust Version
1.78.0 nightly, but also present on the latest nightly and stable