Skip to content

Improve error message: missing ; in macro_rules! rules #124968

Closed
@afifurrohman-id

Description

@afifurrohman-id

Code

#[allow(unused_macros)]
macro_rules! foo {
    () => {
    
    }
    () => {
    
    }
}

Current output

error: no rules expected the token `(`
 --> src/lib.rs:6:5
  |
6 |     () => {
  |     ^ no rules expected this token in macro call

error: could not compile `playground` (lib) due to 1 previous error

Desired output

^ help: add `;` here

error: expected `;`, found () => {

expected `;`, found () => {

Rationale and extra context

one of the desired output should be much help, rather than:

 6 |     () => {
   |     ^ no rules expected this token in macro call

Other cases

No response

Rust Version

Stable from playground:

https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=add0174014b5e09e1f7496551536be4e

Anything else?

No response

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