diff options
| author | bors <bors@rust-lang.org> | 2017-09-02 22:22:54 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-09-02 22:22:54 +0000 |
| commit | 6f667301e22a665b0bf5587ef508da7e01c496c8 (patch) | |
| tree | 835000191cc3ba3a24285b8c16c3334eac944254 /src/libsyntax/parse/parser.rs | |
| parent | 744dd6c1d5db522d5d3b7f2bb82abde5dc41cbeb (diff) | |
| parent | 22ca03bde660e9bca0fbf23b5ab228441d39ab6f (diff) | |
| download | rust-6f667301e22a665b0bf5587ef508da7e01c496c8.tar.gz rust-6f667301e22a665b0bf5587ef508da7e01c496c8.zip | |
Auto merge of #44108 - mattico:match-pipe, r=petrochenkov
Implement RFC 1925 cc #44101
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 7 |
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, }) } |
