Closed
Description
Example:
macro_rules! foo {
() => {
macro_rules! bar {
( $( $any:tt )* ) => { $( $any )* };
}
};
}
fn main() { foo!(); }
https://play.rust-lang.org/?gist=f7355a6828cc2af68cc17f280a982ad8&version=beta&backtrace=0
results in:
error: attempted to repeat an expression containing no syntax variables matched as repeating at this depth
--> <anon>:4:15
|
4 | ( $( $any:tt )* ) => { $( $any )* };
| ^^^^^^^^^^^^
Note
If the repetition is removed, i.e. the offending part ( $( $any:tt )* ) => { $( $any )* };
is changed to ( $any:tt ) => { $any };
, the error disappears on rustc 1.12+ due to the fix of #6994: macros should be parsed more lazily. I find it a bit inconsistent, that nested macros now support binding patterns, but no repetitions.