diff options
| author | Jeffrey Seyfried <jeffrey.seyfried@gmail.com> | 2017-05-15 09:26:26 +0000 |
|---|---|---|
| committer | Jeffrey Seyfried <jeffrey.seyfried@gmail.com> | 2017-05-15 09:26:26 +0000 |
| commit | 9f4e1e10a48f54738b373f4be3667d8f1a8cc2c7 (patch) | |
| tree | c214285334c7c758efac1d0d9b5e303d8a036e91 /src/libsyntax | |
| parent | 9956e81c19c2f5bbc273d75b49f2e031d80d0e4e (diff) | |
| download | rust-9f4e1e10a48f54738b373f4be3667d8f1a8cc2c7.tar.gz rust-9f4e1e10a48f54738b373f4be3667d8f1a8cc2c7.zip | |
Fix regression in `macro_rules!` name matching.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ext/tt/macro_parser.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index eb0b7c29f8d..780b7ec8c2a 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -267,11 +267,12 @@ pub fn parse_failure_msg(tok: Token) -> String { /// Perform a token equality check, ignoring syntax context (that is, an unhygienic comparison) fn token_name_eq(t1 : &Token, t2 : &Token) -> bool { - match (t1,t2) { - (&token::Ident(id1),&token::Ident(id2)) - | (&token::Lifetime(id1),&token::Lifetime(id2)) => - id1.name == id2.name, - _ => *t1 == *t2 + if let (Some(id1), Some(id2)) = (t1.ident(), t2.ident()) { + id1.name == id2.name + } else if let (&token::Lifetime(id1), &token::Lifetime(id2)) = (t1, t2) { + id1.name == id2.name + } else { + *t1 == *t2 } } |
