-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Macros: limitation in the expression parser for <$:path>::<ident> #48067
Copy link
Copy link
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, ..)A-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.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.
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, ..)A-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.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.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Background: https://users.rust-lang.org/t/macros-using-path-tokens-with-format-args/15480
When passing in a
pathtoken to a macro, then trying to suffix the metavariable with::<ident>(or more), the parser cannot recognize the whole thing as an:expr, which causes failures on calls to macros likeformat_args!.Repro:
It fails with three instances of this error (with
RUSTFLAGS='-Z external-macro-backtrace'):A workaround is to use:
but would be great if we could just use:
I couldn't find an existing report. I'm guessing it falls under RFE.