diff options
| author | Edward Wang <edward.yu.wang@gmail.com> | 2014-02-15 16:54:32 +0800 |
|---|---|---|
| committer | Edward Wang <edward.yu.wang@gmail.com> | 2014-02-23 21:20:37 +0800 |
| commit | 386db05df8aa8349857ad6f5486db0bdcc79f3cd (patch) | |
| tree | b85d659e88e28126c3874a194126079c280b7739 /src/libsyntax/ext/tt/macro_parser.rs | |
| parent | 551da0615764853153db944063ae2e271414a71b (diff) | |
| download | rust-386db05df8aa8349857ad6f5486db0bdcc79f3cd.tar.gz rust-386db05df8aa8349857ad6f5486db0bdcc79f3cd.zip | |
Make break and continue hygienic
Makes labelled loops hygiene by performing renaming of the labels
defined in e.g. `'x: loop { ... }` and then used in break and continue
statements within loop body so that they act hygienically when used with
macros.
Closes #12262.
Diffstat (limited to 'src/libsyntax/ext/tt/macro_parser.rs')
| -rw-r--r-- | src/libsyntax/ext/tt/macro_parser.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 456533de5e9..edd875a57a7 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -218,8 +218,9 @@ pub fn parse_or_else<R: Reader>(sess: @ParseSess, // perform a token equality check, ignoring syntax context (that is, an unhygienic comparison) pub fn token_name_eq(t1 : &Token, t2 : &Token) -> bool { match (t1,t2) { - (&token::IDENT(id1,_),&token::IDENT(id2,_)) => - id1.name == id2.name, + (&token::IDENT(id1,_),&token::IDENT(id2,_)) + | (&token::LIFETIME(id1),&token::LIFETIME(id2)) => + id1.name == id2.name, _ => *t1 == *t2 } } |
