about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-05-27 00:42:55 +0000
committerbors <bors@rust-lang.org>2015-05-27 00:42:55 +0000
commite4c64a1499de8a14a34f77c844b7fc1f7cabffd6 (patch)
tree2aeabe631438fae6ebc399979adae243360a7322 /src/libsyntax
parentfe85342ef6c04aeb35b0d0dbde82791f1a8721bb (diff)
parentf21655ec0286769056c73f9b1c847936c577004b (diff)
downloadrust-e4c64a1499de8a14a34f77c844b7fc1f7cabffd6.tar.gz
rust-e4c64a1499de8a14a34f77c844b7fc1f7cabffd6.zip
Auto merge of #25713 - Stebalien:pattern, r=alexcrichton
Needed to support:

```rust
match X {
  pattern if Y ...
}

for pattern in Y {}
```

IMO, this shouldn't require an RFC because it can't interfere with any future language changes (because `pattern if` and `pattern in` are already legal in rust) and can't cause any ambiguity.
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)
                 }
             },