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

decl macro 2.0 doesn't allow trailing comma #63102

Closed
bjorn3 opened this issue Jul 29, 2019 · 2 comments · Fixed by #63198
Closed

decl macro 2.0 doesn't allow trailing comma #63102

bjorn3 opened this issue Jul 29, 2019 · 2 comments · Fixed by #63198
Labels
A-macros-2.0 Area: Declarative macros 2.0 (#39412) A-parser Area: The parsing of Rust source code to an AST. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@bjorn3
Copy link
Member

bjorn3 commented Jul 29, 2019

macro abc {
    () => {},

(Playground)

Errors:

   Compiling playground v0.0.1 (/playground)
error: unexpected end of macro invocation
 --> src/lib.rs:2:14
  |
2 |     () => {},
  |              ^ missing tokens in macro arguments

error: aborting due to previous error

error: Could not compile `playground`.

To learn more, run the command again with --verbose.

@jonas-schievink jonas-schievink added A-macros-2.0 Area: Declarative macros 2.0 (#39412) A-parser Area: The parsing of Rust source code to an AST. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 29, 2019
@matthewjasper
Copy link
Contributor

But they do accept a trailing ;: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=f8bd2841ec49d0222be9ad6124bdd0a4

@bjorn3
Copy link
Member Author

bjorn3 commented Jul 29, 2019

Maybe someone forgot to change the trailing ; into , when changing the separating ; into , in the (copied?) parse code?

Centril added a commit to Centril/rust that referenced this issue Aug 2, 2019
…a, r=petrochenkov

Allow trailing comma in macro 2.0 declarations.

This should hopefully close rust-lang#63102.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macros-2.0 Area: Declarative macros 2.0 (#39412) A-parser Area: The parsing of Rust source code to an AST. C-bug Category: This is a bug. 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.

3 participants