diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2018-02-24 15:52:17 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-02-24 15:52:17 -0800 |
| commit | 9523c82543a8955393e76004bccfb1b26e4e06c1 (patch) | |
| tree | fbafef4b45e775d59c62defed0d5261a956be219 /src/libsyntax/feature_gate.rs | |
| parent | 7e6829938c198afe033119f1927459c64d2ea4d7 (diff) | |
| parent | 8640a51ff8d580bbb87aa3dc0ff8bacbad111010 (diff) | |
| download | rust-9523c82543a8955393e76004bccfb1b26e4e06c1.tar.gz rust-9523c82543a8955393e76004bccfb1b26e4e06c1.zip | |
Rollup merge of #48490 - petrochenkov:orpat, r=eddyb
Implement multiple patterns with `|` in `if let` and `while let` (RFC 2175) cc https://github.com/rust-lang/rust/issues/48215
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 ba24d7f914b..1ebf52e9fe8 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -446,6 +446,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! ( @@ -1618,6 +1621,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); |
