-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.D-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
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
coffeenotfound
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.D-terseDiagnostics: An error or lint that doesn't give enough information about the problem at hand.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.