-
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 lintsD-imprecise-spansDiagnostics: spans don't point to exactly the erroneous codeDiagnostics: spans don't point to exactly the erroneous codeD-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.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
Code
trait A<T> {
fn f(self, x: T);
}
fn main() {
A::f(1, "");
}
Current output
error[E0277]: the trait bound `{integer}: A<_>` is not satisfied
--> src/lib.rs:6:13
|
6 | A::f(1, "");
| ---- ^^ the trait `A<_>` is not implemented for `{integer}`
| |
| required by a bound introduced by this call
|
help: this trait has no implementations, consider adding one
--> src/lib.rs:1:1
|
1 | trait A<T> {
| ^^^^^^^^^^
For more information about this error, try `rustc --explain E0277`.
Desired output
error[E0277]: the trait bound `{integer}: A` is not satisfied
--> src/lib.rs:6:10
|
6 | A::f(1, "");
| ---- ^ the trait `A` is not implemented for `{integer}`
| |
| required by a bound introduced by this call
|
help: this trait has no implementations, consider adding one
--> src/lib.rs:1:1
|
1 | trait A {
| ^^^^^^^
For more information about this error, try `rustc --explain E0277`.
Rationale and extra context
No response
Other cases
Rust Version
$ rustc --version --verbose
rustc 1.90.0-nightly (71e4c005c 2025-07-01)
binary: rustc
commit-hash: 71e4c005caa812a16fcb08d0bf1e6f1eda7c8381
commit-date: 2025-07-01
host: x86_64-unknown-linux-gnu
release: 1.90.0-nightly
LLVM version: 20.1.7
Anything else?
This is probably related to #83868? That one also emits a misleading diagnostic on the argument, but in this case even the diagnostic on self
is missing.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-imprecise-spansDiagnostics: spans don't point to exactly the erroneous codeDiagnostics: spans don't point to exactly the erroneous codeD-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.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.