Skip to content

Unhelpful "not a function" error when missing a semicolon #51055

Closed
@HMPerson1

Description

@HMPerson1

This code (playground):

fn foo() {}
fn bar() -> (i32, i32) {
    foo() // missing semicolon
    
    (0, 0)
}

gives the unhelpful error message:

error[E0618]: expected function, found `()`
 --> src/main.rs:3:5
  |
3 | /     foo() // missing semicolon
4 | |     
5 | |     (0, 0)
  | |__________^ not a function

Happens on 1.26.0-stable and 1.28.0-nightly (2018-05-23 29ffe51).

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.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