diff options
| author | Lzu Tao <taolzu@gmail.com> | 2020-07-14 07:53:23 +0000 |
|---|---|---|
| committer | Lzu Tao <taolzu@gmail.com> | 2020-08-08 10:38:46 +0000 |
| commit | 57c5da8f1c1d36da3b69e98a75ed54efb4b45329 (patch) | |
| tree | 5cd29b1eb94f0a16d3eacc04cbb45892f24471e2 /src/librustc_ast_passes | |
| parent | d19d7e27552b8da17932384b8db53927a1f4e00e (diff) | |
| download | rust-57c5da8f1c1d36da3b69e98a75ed54efb4b45329.tar.gz rust-57c5da8f1c1d36da3b69e98a75ed54efb4b45329.zip | |
Gate to if-let guard feature
Diffstat (limited to 'src/librustc_ast_passes')
| -rw-r--r-- | src/librustc_ast_passes/feature_gate.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/librustc_ast_passes/feature_gate.rs b/src/librustc_ast_passes/feature_gate.rs index ce39ceff8f3..95257f29a87 100644 --- a/src/librustc_ast_passes/feature_gate.rs +++ b/src/librustc_ast_passes/feature_gate.rs @@ -612,11 +612,14 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session) { let spans = sess.parse_sess.gated_spans.spans.borrow(); macro_rules! gate_all { ($gate:ident, $msg:literal) => { - for span in spans.get(&sym::$gate).unwrap_or(&vec![]) { - gate_feature_post!(&visitor, $gate, *span, $msg); + if let Some(spans) = spans.get(&sym::$gate) { + for span in spans { + gate_feature_post!(&visitor, $gate, *span, $msg); + } } }; } + gate_all!(if_let_guard, "`if let` guard is not implemented"); gate_all!(let_chains, "`let` expressions in this position are experimental"); gate_all!(async_closure, "async closures are unstable"); gate_all!(generators, "yield syntax is experimental"); |
