diff options
| author | bors <bors@rust-lang.org> | 2018-09-01 20:31:29 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-09-01 20:31:29 +0000 |
| commit | 28bcffead74d5e17c6cb1f7de432e37f93a6b50c (patch) | |
| tree | 1abf601a008600ac3a23c22c1ce003c571dee816 /src/libsyntax/parse | |
| parent | f39f218ec33d93e8a1b0ac4282f62ee35e02c18a (diff) | |
| parent | 7a083ca25f14833d704d2efba5ca9b431f6c65ad (diff) | |
| download | rust-28bcffead74d5e17c6cb1f7de432e37f93a6b50c.tar.gz rust-28bcffead74d5e17c6cb1f7de432e37f93a6b50c.zip | |
Auto merge of #53815 - F001:if-let-guard, r=petrochenkov
refactor match guard This is the first step to implement RFC 2294: if-let-guard. Tracking issue: https://github.com/rust-lang/rust/issues/51114 The second step should be introducing another variant `IfLet` in the Guard enum. I separated them into 2 PRs for the convenience of reviewers. r? @petrochenkov
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 6c50b9c82f2..c741bde7c5f 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -12,7 +12,7 @@ use rustc_target::spec::abi::{self, Abi}; use ast::{AngleBracketedArgs, ParenthesisedArgs, AttrStyle, BareFnTy}; use ast::{GenericBound, TraitBoundModifier}; use ast::Unsafety; -use ast::{Mod, AnonConst, Arg, Arm, Attribute, BindingMode, TraitItemKind}; +use ast::{Mod, AnonConst, Arg, Arm, Guard, Attribute, BindingMode, TraitItemKind}; use ast::Block; use ast::{BlockCheckMode, CaptureBy, Movability}; use ast::{Constness, Crate}; @@ -3533,7 +3533,7 @@ impl<'a> Parser<'a> { self.eat(&token::BinOp(token::Or)); let pats = self.parse_pats()?; let guard = if self.eat_keyword(keywords::If) { - Some(self.parse_expr()?) + Some(Guard::If(self.parse_expr()?)) } else { None }; |
