about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorSteven Allen <steven@stebalien.com>2015-05-22 10:37:44 -0400
committerSteven Allen <steven@stebalien.com>2015-05-22 12:47:52 -0400
commitf21655ec0286769056c73f9b1c847936c577004b (patch)
tree3d810dff3431ba98df386c0374c22f84ca1f79c0 /src/libsyntax
parentc3d60aba6c86883c79055c1a3923d4db116b644e (diff)
downloadrust-f21655ec0286769056c73f9b1c847936c577004b.tar.gz
rust-f21655ec0286769056c73f9b1c847936c577004b.zip
Allow patterns to be followed by if and in.
Needed to support:

match X {
  pattern if Y ...
}

for pattern in Y {}
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ext/tt/macro_rules.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs
index febfc7a97fe..03d4e21a941 100644
--- a/src/libsyntax/ext/tt/macro_rules.rs
+++ b/src/libsyntax/ext/tt/macro_rules.rs
@@ -495,6 +495,7 @@ fn is_in_follow(_: &ExtCtxt, tok: &Token, frag: &str) -> Result<bool, String> {
             "pat" => {
                 match *tok {
                     FatArrow | Comma | Eq => Ok(true),
+                    Ident(i, _) if i.as_str() == "if" || i.as_str() == "in" => Ok(true),
                     _ => Ok(false)
                 }
             },