diff options
| author | bors <bors@rust-lang.org> | 2019-01-12 08:40:17 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-01-12 08:40:17 +0000 |
| commit | 1190f7cdf7a62e25c9a8eaf58e0906849692bf2b (patch) | |
| tree | ded178d6a40bf214117f545d8c3f614b6b438d56 /src/libsyntax/parse | |
| parent | 0c91f3d97fe78d31c8cf3abb1858c65d73c6aa17 (diff) | |
| parent | 561483e4e84405f832ada8f9435cd8c471139afb (diff) | |
| download | rust-1190f7cdf7a62e25c9a8eaf58e0906849692bf2b.tar.gz rust-1190f7cdf7a62e25c9a8eaf58e0906849692bf2b.zip | |
Auto merge of #57532 - Centril:stabilize-2175, r=varkor
Stabilize #![feature(if_while_or_patterns)] r? @varkor Per https://github.com/rust-lang/rust/issues/56212#issue-384085857. Leading `|` is also accepted per the comment in the stabilization proposal.
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 5 |
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()?); |
