-
Notifications
You must be signed in to change notification settings - Fork 13.7k
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.
Description
I tried this code:
macro_rules! makro {
(
$(
[ $( $fn_type: ident )* ]
)?
$fn_vis: vis
) => { };
}
makro! { [unsafe] pub }
I expected to see this happen: It compiles
Instead, this happened:
Compiling playground v0.0.1 (/playground)
error: local ambiguity when calling macro `makro`: multiple parsing options: built-in NTs vis ('fn_vis') or 1 other option.
--> src/lib.rs:13:10
|
13 | makro! { [unsafe] pub }
| ^
error: could not compile `playground` (lib) due to 1 previous error
rustc --version --verbose
:
rustc 1.82.0-nightly (cefe1dcef 2024-07-22)
binary: rustc
commit-hash: cefe1dcef0e21f4d0c8ea856ad61c1936dfb7913
commit-date: 2024-07-22
host: x86_64-pc-windows-msvc
release: 1.82.0-nightly
LLVM version: 18.1.7
This also happens in stable Rust, playground link: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=b75389208cdb78680bab4ba33bb90efb
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.