diff options
| author | bors <bors@rust-lang.org> | 2021-01-12 02:56:51 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-01-12 02:56:51 +0000 |
| commit | 467f5e99a541db94235f0c173bdffc8aeb177522 (patch) | |
| tree | 49044dd7f4359e27a047f8bb6c3349dcc2e86e59 /compiler/rustc_parse/src/parser/expr.rs | |
| parent | 04064416644eba7351b1a457c1de27d28a750c95 (diff) | |
| parent | 5b475a46181cc4e8bfe2ac64f3724a5c485d6c5c (diff) | |
| download | rust-467f5e99a541db94235f0c173bdffc8aeb177522.tar.gz rust-467f5e99a541db94235f0c173bdffc8aeb177522.zip | |
Auto merge of #76580 - rokob:iss76011, r=estebank
Suggest async {} for async || {}
Fixes #76011
This adds support for adding help diagnostics to the feature gating checks and
then uses it for the async_closure gate to add the extra bit of help
information as described in the issue.
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/expr.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index d11db74a3bd..f4332e4548a 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -1599,10 +1599,6 @@ impl<'a> Parser<'a> { } else { Async::No }; - if let Async::Yes { span, .. } = asyncness { - // Feature-gate `async ||` closures. - self.sess.gated_spans.gate(sym::async_closure, span); - } let capture_clause = self.parse_capture_clause()?; let decl = self.parse_fn_block_decl()?; @@ -1619,6 +1615,11 @@ impl<'a> Parser<'a> { } }; + if let Async::Yes { span, .. } = asyncness { + // Feature-gate `async ||` closures. + self.sess.gated_spans.gate(sym::async_closure, span); + } + Ok(self.mk_expr( lo.to(body.span), ExprKind::Closure(capture_clause, asyncness, movability, decl, body, lo.to(decl_hi)), |
