about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-01-11 23:57:04 +0100
committerMazdak Farrokhzad <twingoow@gmail.com>2019-01-11 23:57:04 +0100
commit561483e4e84405f832ada8f9435cd8c471139afb (patch)
treed940ece6586e0032d214f8dd7b7718b27f50c59d /src/libsyntax/parse
parentb43986184b8f4e0d633e8ae1704f0e19aec30cb2 (diff)
downloadrust-561483e4e84405f832ada8f9435cd8c471139afb.tar.gz
rust-561483e4e84405f832ada8f9435cd8c471139afb.zip
stabilize top level or-pats in if/while let.
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 1e4a26b3537..b90eeaca54b 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -3660,8 +3660,6 @@ impl<'a> Parser<'a> {
         maybe_whole!(self, NtArm, |x| x);
 
         let attrs = self.parse_outer_attributes()?;
-        // Allow a '|' before the pats (RFC 1925)
-        self.eat(&token::BinOp(token::Or));
         let pats = self.parse_pats()?;
         let guard = if self.eat_keyword(keywords::If) {
             Some(Guard::If(self.parse_expr()?))
@@ -3768,6 +3766,9 @@ impl<'a> Parser<'a> {
 
     /// Parse patterns, separated by '|' s
     fn parse_pats(&mut self) -> PResult<'a, Vec<P<Pat>>> {
+        // Allow a '|' before the pats (RFC 1925 + RFC 2530)
+        self.eat(&token::BinOp(token::Or));
+
         let mut pats = Vec::new();
         loop {
             pats.push(self.parse_top_level_pat()?);