Closed
Description
trait Trait {}
fn foo() -> impl Trait {
0u8
}
Currently emits
error[E0277]: the trait bound `u8: Trait` is not satisfied
--> src/lib.rs:3:13
|
3 | fn foo() -> impl Trait {
| ^^^^^^^^^^ the trait `Trait` is not implemented for `u8`
It should probably point to the return value as the span of the actual error, with the current span appearing in a note, e.g.
error[E0277]: the trait bound `u8: Trait` is not satisfied
--> src/lib.rs:4:4
|
3 | fn foo() -> impl Trait {
| ---------- the return value of this function must implement `Trait`
4 | 0u8
| ^^^ the trait `Trait` is not implemented for `u8`
@rustbot label T-compiler A-impl-trait A-diagnostics D-terse
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.Relevant to the compiler team, which will review and decide on the PR/issue.