-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Closed
Copy link
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-newcomer-roadblockDiagnostics: Confusing error or lint; hard to understand for new users.Diagnostics: Confusing error or lint; hard to understand for new users.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
Given the following code:
struct Foo;
fn From<i32> for Foo {
fn from(a: i32) -> Self {
Foo
}
}
fn main() {}
The current output is:
error: expected `(`, found keyword `for`
--> src/main.rs:3:14
|
3 | fn From<i32> for Foo {
| ^^^ expected `(`
I wonder if we can detect that this is supposed to be trait impl, maybe look for <Trait> for <Ty>
or something?
Ideally the output should look like:
--> src/main.rs:3:14
|
3 | fn From<i32> for Foo {
| ^^ expected `impl`, found "fn"
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-newcomer-roadblockDiagnostics: Confusing error or lint; hard to understand for new users.Diagnostics: Confusing error or lint; hard to understand for new users.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.