Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misspelling of macro_rules! #91227

Closed
booleancoercion opened this issue Nov 25, 2021 · 0 comments · Fixed by #91337
Closed

Misspelling of macro_rules! #91227

booleancoercion opened this issue Nov 25, 2021 · 0 comments · Fixed by #91337
Labels
A-diagnostics Area: Messages for errors, warnings, and lints D-confusing Diagnostics: Confusing error or lint that should be reworked. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@booleancoercion
Copy link
Contributor

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.

@booleancoercion booleancoercion added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 25, 2021
@jyn514 jyn514 added the D-confusing Diagnostics: Confusing error or lint that should be reworked. label Nov 26, 2021
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Dec 8, 2021
…macro, r=nagisa

Add a suggestion if `macro_rules` is misspelled

Fixes rust-lang#91227.
@bors bors closed this as completed in d26fc45 Dec 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints D-confusing Diagnostics: Confusing error or lint that should be reworked. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants