Cannot use =>
inside the body of a macro_rules for defining match arms
#113766
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-macros
Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)
A-parser
Area: The parsing of Rust source code to an AST
D-terse
Diagnostics: An error or lint that doesn't give enough information about the problem at hand.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
I tried this code:
Cargo expand output
I expected to see this happen: It compiles successfully, generating my match arms.
Instead, this happened: Match arms are eaten in macro expansion (according to intellij-rust, as cargo-expand doesn't even show anything) - if I wrap the arm in () within the macro definition (i.e.
(a => b)
), it works, but this is not a valid match arm.My understanding is that the macro is getting confused with the pattern:
It appears to see
) => { (
as a patternMeta
rustc --version --verbose
:Backtrace
The text was updated successfully, but these errors were encountered: