diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2018-02-24 03:12:35 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2018-02-24 03:12:35 +0300 |
| commit | 8640a51ff8d580bbb87aa3dc0ff8bacbad111010 (patch) | |
| tree | 88f843f5e37f4dcc658bb13104dba12e119a3b71 /src/libsyntax/feature_gate.rs | |
| parent | 063deba92e44809125a433ca6e6c1ad0993313bf (diff) | |
| download | rust-8640a51ff8d580bbb87aa3dc0ff8bacbad111010.tar.gz rust-8640a51ff8d580bbb87aa3dc0ff8bacbad111010.zip | |
Implement multiple patterns with `|` in `if let` and `while let`
Diffstat (limited to 'src/libsyntax/feature_gate.rs')
| -rw-r--r-- | src/libsyntax/feature_gate.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index c0fde71d086..04f2a0048fa 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -449,6 +449,9 @@ declare_features! ( // Use `?` as the Kleene "at most one" operator (active, macro_at_most_once_rep, "1.25.0", Some(48075)), + + // Multiple patterns with `|` in `if let` and `while let` + (active, if_while_or_patterns, "1.26.0", Some(48215)), ); declare_features! ( @@ -1686,6 +1689,12 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { ast::ExprKind::Catch(_) => { gate_feature_post!(&self, catch_expr, e.span, "`catch` expression is experimental"); } + ast::ExprKind::IfLet(ref pats, ..) | ast::ExprKind::WhileLet(ref pats, ..) => { + if pats.len() > 1 { + gate_feature_post!(&self, if_while_or_patterns, e.span, + "multiple patterns in `if let` and `while let` are unstable"); + } + } _ => {} } visit::walk_expr(self, e); |
