Closed
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.