Skip to content

"call expression requires function" error points to wrong definition #80853

Closed
@camelid

Description

@camelid
struct S;

fn repro_ref(thing: S) {
    thing();
}

(Playground)

It should either point to the definition of S or it should say "thing defined here":

   Compiling playground v0.0.1 (/playground)
error[E0618]: expected function, found `S`
 --> src/lib.rs:4:5
  |
3 | fn repro_ref(thing: S) {
  |              ----- `S` defined here
4 |     thing();
  |     ^^^^^--
  |     |
  |     call expression requires function

error: aborting due to previous error

For more information about this error, try `rustc --explain E0618`.
error: could not compile `playground`

To learn more, run the command again with --verbose.

Metadata

Metadata

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.D-confusingDiagnostics: Confusing error or lint that should be reworked.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions