about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorMatt Ickstadt <mattico8@gmail.com>2017-08-26 17:09:31 -0500
committerMatt Ickstadt <mattico8@gmail.com>2017-09-01 12:46:37 -0500
commitf86615299190b77fd5890ee3951ed85e36d829df (patch)
tree5a0f7f160bb0ad56786454d03222fee0fad8768c /src/libsyntax/parse
parented532c0d933aaae45e6804efc5936bea078bbaad (diff)
downloadrust-f86615299190b77fd5890ee3951ed85e36d829df.tar.gz
rust-f86615299190b77fd5890ee3951ed85e36d829df.zip
Implement RFC 1925
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index d08373334f1..1f033b25fe4 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -3155,6 +3155,12 @@ impl<'a> Parser<'a> {
         maybe_whole!(self, NtArm, |x| x);
 
         let attrs = self.parse_outer_attributes()?;
+        // Allow a '|' before the pats (RFC 1925)
+        let beginning_vert = if self.eat(&token::BinOp(token::Or)) {
+            Some(self.prev_span)
+        } else {
+            None
+        };
         let pats = self.parse_pats()?;
         let guard = if self.eat_keyword(keywords::If) {
             Some(self.parse_expr()?)
@@ -3178,6 +3184,7 @@ impl<'a> Parser<'a> {
             pats,
             guard,
             body: expr,
+            beginning_vert,
         })
     }