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

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

Closed
afifurrohman-id opened this issue May 10, 2024 · 1 comment · Fixed by #125180
Closed

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

afifurrohman-id opened this issue May 10, 2024 · 1 comment · Fixed by #125180
Assignees
Labels
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.

Comments

@afifurrohman-id
Copy link

afifurrohman-id commented May 10, 2024

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

@afifurrohman-id afifurrohman-id 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 May 10, 2024
@mu001999
Copy link
Contributor

@rustbot claim

bors added a commit to rust-lang-ci/rust that referenced this issue May 16, 2024
… r=<try>

Improve error message: missing `;` in macro_rules

Fixes rust-lang#124968
bors added a commit to rust-lang-ci/rust that referenced this issue May 17, 2024
… r=<try>

Improve error message: missing `;` in macro_rules

Fixes rust-lang#124968
@bors bors closed this as completed in 685a80f May 18, 2024
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 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