Suggest using -> impl Trait
when returning type parameter -> T where T: Trait
#85991
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-impl-trait
Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
D-newcomer-roadblock
Diagnostics: Confusing error or lint; hard to understand for new users.
D-papercut
Diagnostics: An error or lint that needs small tweaks.
P-low
Low priority
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Some newcomers are confused by
impl Trait
in return position because they have first internalizedimpl Trait
as an alias for type parameters in argument position. Because of this, some people try the following:We don't currently point them in the right direction, like we do in other cases.
Took inspiration from https://twitter.com/JaapRood/status/1400782159812628482
The text was updated successfully, but these errors were encountered: