- Notifications
You must be signed in to change notification settings - Fork 14.1k
Open
Labels
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language teamWG-macrosWorking group: MacrosWorking group: Macros
Description
I tried this code:
macro_rules! m { ( ($v:vis) ) => {}; } fn main() { m!( () ); }I expected to see this happen: the code compile successfully. The reference says vis is "a possibly empty Visibility qualifier", so it should match empty.
Instead, this happened: the code is rejected with:
error: no rules expected the token `)` --> src/main.rs:6:10 | 1 | macro_rules! m { | -------------- when calling this macro ... 6 | m!( () ); | ^ no rules expected this token in macro call | note: while trying to match meta-variable `$v:vis` --> src/main.rs:2:8 | 2 | ( ($v:vis) ) => {}; | ^^^^^^ @rustbot label +A-macros
Metadata
Metadata
Assignees
Labels
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language teamWG-macrosWorking group: MacrosWorking group: Macros