Description
RFC 550 (https://github.com/rust-lang/rfcs/blob/master/text/0550-macro-future-proofing.md) restricted macro syntax to future-proof against changes to Rust syntax. However, this breaks a case that can be handled unambiguously, namely repetition of the same token that splits off the rightmost rather than leftmost item:
macro_rules! foo {
() => ( ... );
( $($init:ident)* $last:ident ) => ( ... foo! { $($init)* } );
}
This produces the following error:
error: local ambiguity: multiple parsing options: built-in NTs ident ('init') or ident ('last') or 0 other options.
This kind of syntax is useful for recursively parsing a list and repeatedly dropping the last item (rather than repeatedly dropping the first).
Rust should be able to handle this case unambiguously, as long as the repeated token type can't match the closing delimiter of the macro, which ident clearly never will.