Merge Async and Gen into CoroutineKind
This commit is contained in:
parent
3887b1645a
commit
48d5f1f0f2
25 changed files with 442 additions and 238 deletions
|
@ -21,7 +21,9 @@ use rustc_ast::util::parser::{prec_let_scrutinee_needs_par, AssocOp, Fixity};
|
|||
use rustc_ast::visit::Visitor;
|
||||
use rustc_ast::{self as ast, AttrStyle, AttrVec, CaptureBy, ExprField, UnOp, DUMMY_NODE_ID};
|
||||
use rustc_ast::{AnonConst, BinOp, BinOpKind, FnDecl, FnRetTy, MacCall, Param, Ty, TyKind};
|
||||
use rustc_ast::{Arm, Async, BlockCheckMode, Expr, ExprKind, Label, Movability, RangeLimits};
|
||||
use rustc_ast::{
|
||||
Arm, BlockCheckMode, CoroutineKind, Expr, ExprKind, Label, Movability, RangeLimits,
|
||||
};
|
||||
use rustc_ast::{ClosureBinder, MetaItemLit, StmtKind};
|
||||
use rustc_ast_pretty::pprust;
|
||||
use rustc_data_structures::stack::ensure_sufficient_stack;
|
||||
|
@ -2237,7 +2239,7 @@ impl<'a> Parser<'a> {
|
|||
let asyncness = if self.token.uninterpolated_span().at_least_rust_2018() {
|
||||
self.parse_asyncness(Case::Sensitive)
|
||||
} else {
|
||||
Async::No
|
||||
CoroutineKind::None
|
||||
};
|
||||
|
||||
let capture_clause = self.parse_capture_clause()?;
|
||||
|
@ -2261,7 +2263,7 @@ impl<'a> Parser<'a> {
|
|||
}
|
||||
};
|
||||
|
||||
if let Async::Yes { span, .. } = asyncness {
|
||||
if let CoroutineKind::Async { span, .. } = asyncness {
|
||||
// Feature-gate `async ||` closures.
|
||||
self.sess.gated_spans.gate(sym::async_closure, span);
|
||||
}
|
||||
|
@ -2284,7 +2286,7 @@ impl<'a> Parser<'a> {
|
|||
binder,
|
||||
capture_clause,
|
||||
constness,
|
||||
asyncness,
|
||||
coro_kind: asyncness,
|
||||
movability,
|
||||
fn_decl,
|
||||
body,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue