"The following implementations were found" should also mention the trait bounds.
97bdbfc
Opened by kennytm at
Test case:
struct Index;
fn iterate(s: std::collections::HashSet<Index>) {
for _ in s {}
}
This errors with:
error[E0277]: the trait bound `std::collections::HashSet<Index>: std::iter::IntoIterator` is not satisfied
--> src/main.rs:3:5
|
3 | for _ in s {}
| ^^^^^^^^^^^^^ the trait `std::iter::IntoIterator` is not implemented for `std::collections::HashSet<Index>`
|
= help: the following implementations were found:
<std::collections::HashSet<T, S> as std::iter::IntoIterator>
<&'a std::collections::HashSet<T, S> as std::iter::IntoIterator>
= note: required by `std::iter::IntoIterator::into_iter`
So, the error is HashSet<Index> does not implement IntoIterator, but the help also suggests that HashSet<T, S> does implement IntoIterator, so what is it??
The help should also mention the bounds T: Eq + Hash. Or even better, points out that this impl is not chosen because Index does not implement Eq + Hash.
(Original source code: https://stackoverflow.com/revisions/45717092/2. Tested on playground, rustc 1.21.0-nightly (df511d554 2017-08-14) running on x86_64-unknown-linux-gnu)
It could also mention where they were defined (file and line n°)
Thomas B at 2019-01-03 02:34:22