Closed
Description
This issue describes a suggestion I wish the compiler made. Given the following code:
use futures::stream::Stream;
struct Foo<T>
where
T: Stream,
<T as Stream>::Item: String,
{
t: T,
}
The compiler produces this error:
error[E0404]: expected trait, found struct `String`
--> src/lib.rs:6:26
|
6 | <T as Stream>::Item: String,
| ^^^^^^ help: a trait with a similar name exists: `ToString`
It would be nice if the compiler suggested changing it to
use futures::stream::Stream;
struct Foo<T>
where
T: Stream<Item = String>,
{
t: T,
}
The same applies to impl blocks, that also don't produce the suggestion.
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: Suggestions generated by the compiler applied by `cargo fix`Category: An issue proposing an enhancement or a PR with one.Diagnostics: Confusing error or lint; hard to understand for new users.Relevant to the compiler team, which will review and decide on the PR/issue.