-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.
Description
Noticed this while reviewing. Code as such:
struct Foo(());
fn banana() -> Foo { Foo }
results in the following diagnostic:
1 | struct Foo(());
| ---------- fn(()) -> Foo {Foo} defined here
2 |
3 | fn banana() -> Foo { Foo }
| --- ^^^ expected struct `Foo`, found fn item
| |
| expected `Foo` because of return type
|
= note: expected struct `Foo`
found fn item `fn(()) -> Foo {Foo}`
it isn’t particularly obvious what is the relation between struct
and a function definition. Instead the span could say something like:
1 | struct Foo(());
| ---------- also defines a constructor function `fn(()) -> Foo {Foo}`
or somesuch.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.