Skip to content

Provide a clearer error message for semicolons after structs and similar #51603

Closed
@joshtriplett

Description

@joshtriplett

Right now, writing something like struct S {}; just produces a parse error:

error: expected item, found `;`
 --> src/main.rs:1:12
  |
1 | struct S {};
  |            ^ help: consider removing this semicolon

We could make this error message much clearer by recognizing this common error and specifically saying "don't put a semicolon after a struct/union/enum declaration".

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-frontendArea: Compiler frontend (errors, parsing and HIR)C-feature-requestCategory: A feature request, i.e: not implemented / a PR.WG-diagnosticsWorking group: Diagnostics

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions