Confusing notes with per-method where-bounds when bounds are not satisfied #75222
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-traits
Area: Trait system
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
D-confusing
Diagnostics: Confusing error or lint that should be reworked.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
The following code:
playground
outputs the following error:
The
note
in this error is confusing as it only leads further away from the solution and is also difficult to read. In particular it is talking about trait bounds, but the<&Peach as Fruit>::Error = _
presented is not even a trait bound. The real problem here is thatF: Fruit
is not satisfied.The error message improves significantly when the bound is moved to the
impl
generic instead as such:We should strive for a similar note when the where-bound is applied to method like in the original example.
The text was updated successfully, but these errors were encountered: