about summary refs log tree commit diff
path: root/src/libsyntax/ast.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-02-23 15:37:05 -0800
committerbors <bors@rust-lang.org>2014-02-23 15:37:05 -0800
commit329fcd48e508ebe41e6d2425c0f54b2210af401d (patch)
treeb5297ad96ec683968e1b5dee486710be4a7c8ab3 /src/libsyntax/ast.rs
parentcbed3321f5bbe4375819dd82193bd4299fabafb9 (diff)
parent386db05df8aa8349857ad6f5486db0bdcc79f3cd (diff)
auto merge of #12338 : edwardw/rust/hygienic-break-continue, r=cmr
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/ast.rs')
-rw-r--r--src/libsyntax/ast.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index 8bc3888b1d0..4e43592ec5c 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -58,8 +58,13 @@ impl Eq for Ident {
             // if it should be non-hygienic (most things are), just compare the
             // 'name' fields of the idents. Or, even better, replace the idents
             // with Name's.
-            fail!("not allowed to compare these idents: {:?}, {:?}.
-                    Probably related to issue \\#6993", self, other);
+            //
+            // On the other hand, if the comparison does need to be hygienic,
+            // one example and its non-hygienic counterpart would be:
+            //      syntax::parse::token::mtwt_token_eq
+            //      syntax::ext::tt::macro_parser::token_name_eq
+            fail!("not allowed to compare these idents: {:?}, {:?}. \
+                   Probably related to issue \\#6993", self, other);
         }
     }
     fn ne(&self, other: &Ident) -> bool {
@@ -564,8 +569,8 @@ pub enum Expr_ {
     ExprPath(Path),
 
     ExprAddrOf(Mutability, @Expr),
-    ExprBreak(Option<Name>),
-    ExprAgain(Option<Name>),
+    ExprBreak(Option<Ident>),
+    ExprAgain(Option<Ident>),
     ExprRet(Option<@Expr>),
 
     /// Gets the log level for the enclosing module