Skip to content

Misspelling of macro_rules! #91227

Closed
@booleancoercion

Description

@booleancoercion

Consider the following snippet:

marco_rules! thing {
    () => {}
}

It might look completely fine at first, but then rustc spits out this error message:

error: expected one of `(`, `[`, or `{`, found `thing`
 --> src/lib.rs:1:14
  |
1 | marco_rules! thing {
  |              ^^^^^ expected one of `(`, `[`, or `{`

The actual problem is that macro_rules is misspelled as ma*rc*o_rules. It took me a while to see the problem myself when I encountered it.

Could there possibly be a lint that checks for this case and gives a proper error message? The current one is extra misleading since it even points away from the actual source of the error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsD-confusingDiagnostics: Confusing error or lint that should be reworked.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