Skip to content

Suggest remove extra semicolon in a trait def #159542

Closed

Description

@chenyukang

Found this issue in investigating #159492

Code

trait Factory {
    fn create() -> u32;;
    fn second() -> u32;
}

fn main() {}

Current output

error: non-item in item list
 --> src/main.rs:2:24
  |
1 | trait Factory {
  |               - item list starts here
2 |     fn create() -> u32;;
  |                        ^ non-item starts here
3 |     fn second() -> u32;
4 | }
  | - item list ends here

Desired output

error: non-item in item list
 --> src/main.rs:2:24
  |
1 | trait Factory {
  |               - item list starts here
2 |     fn create() -> u32;;
  |                        ^ non-item starts here
3 |     fn second() -> u32;
4 | }
  | - item list ends here

help: remove this semicolon
  |
2 -     fn create() -> u32;;
2 +     fn create() -> u32;

Rationale and extra context

No response

Other cases

Rust Version

rustc 1.95.0 (59807616e 2026-04-14)
binary: rustc
commit-hash: 59807616e1fa2540724bfbac14d7976d7e4a3860
commit-date: 2026-04-14
host: aarch64-apple-darwin
release: 1.95.0
LLVM version: 22.1.2

Anything else?

No response

Activity

  1. added
    A-diagnosticsArea: Messages for errors, warnings, and lints
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Jul 19, 2026
  2. self-assigned this
    on Jul 19, 2026
  3. added a commit that references this issue on Jul 21, 2026
    18b6b90
  4. added a commit that references this issue on Jul 21, 2026
    490af95
  5. added a commit that references this issue on Jul 22, 2026
    680745c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsT-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