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.
This commit is contained in:
parent
25b2f48612
commit
5b475a4618
5 changed files with 34 additions and 17 deletions
|
@ -1554,10 +1554,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()?;
|
||||
|
@ -1574,6 +1570,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)),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue