Expand Type::Macro and Pat::Macro into real variants
diff --git a/src/expr.rs b/src/expr.rs
index 17834d4..6578aff 100644
--- a/src/expr.rs
+++ b/src/expr.rs
@@ -681,7 +681,9 @@
pub back: Delimited<Pat, Token![,]>,
}),
/// A macro pattern; pre-expansion
- pub Macro(Macro),
+ pub Macro(PatMacro {
+ pub mac: Macro,
+ }),
pub Verbatim(PatVerbatim #manual_extra_traits {
pub tts: TokenStream,
}),
@@ -2105,7 +2107,7 @@
|
syn!(PatStruct) => { Pat::Struct } // must be before pat_ident
|
- syn!(Macro) => { Pat::Macro } // must be before pat_ident
+ syn!(PatMacro) => { Pat::Macro } // must be before pat_ident
|
syn!(PatLit) => { Pat::Lit } // must be before pat_ident
|
@@ -2413,6 +2415,11 @@
}
));
}
+
+ #[cfg(feature = "full")]
+ impl Synom for PatMacro {
+ named!(parse -> Self, map!(syn!(Macro), |mac| PatMacro { mac: mac }));
+ }
}
#[cfg(feature = "printing")]
@@ -3124,6 +3131,13 @@
}
#[cfg(feature = "full")]
+ impl ToTokens for PatMacro {
+ fn to_tokens(&self, tokens: &mut Tokens) {
+ self.mac.to_tokens(tokens);
+ }
+ }
+
+ #[cfg(feature = "full")]
impl ToTokens for PatVerbatim {
fn to_tokens(&self, tokens: &mut Tokens) {
self.tts.to_tokens(tokens);