Fix parsing of patterns in macros

This commit is contained in:
Vadim Petrochenkov 2015-04-02 15:09:43 +03:00
parent 35c1bdb2b4
commit 76567a64c1
1 changed files with 3 additions and 1 deletions

View File

@ -3160,7 +3160,9 @@ impl<'a> Parser<'a> {
// Parse pattern starting with a path // Parse pattern starting with a path
if self.token.is_plain_ident() && self.look_ahead(1, |t| *t != token::DotDotDot && if self.token.is_plain_ident() && self.look_ahead(1, |t| *t != token::DotDotDot &&
*t != token::OpenDelim(token::Brace) && *t != token::OpenDelim(token::Brace) &&
*t != token::OpenDelim(token::Paren)) { *t != token::OpenDelim(token::Paren) &&
// Contrary to its definition, a plain ident can be followed by :: in macros
*t != token::ModSep) {
// Plain idents have some extra abilities here compared to general paths // Plain idents have some extra abilities here compared to general paths
if self.look_ahead(1, |t| *t == token::Not) { if self.look_ahead(1, |t| *t == token::Not) {
// Parse macro invocation // Parse macro invocation