Skip to content

suggest removing ; after derive attribute in case of error #93942

Closed
@matthiaskrgr

Description

@matthiaskrgr

Given the following code:

#[derive(Debug, Clone)];
struct Todo {
    item: String,
}

The current output is:

error: expected item after attributes
 --> src/main.rs:5:1
  |
5 | #[derive(Debug, Clone)];
  | ^^^^^^^^^^^^^^^^^^^^^^^

Ideally the output should look like:

Rust could point at the semicolon (which causes the error) and suggest removing it in this case.

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsD-papercutDiagnostics: An error or lint that needs small tweaks.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.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