1
Fork 0

coro_kind -> coroutine_kind

This commit is contained in:
Michael Goulet 2023-12-05 21:39:36 +00:00
parent 96bb542a31
commit 2806c2df7b
23 changed files with 100 additions and 75 deletions

View file

@ -2285,7 +2285,7 @@ impl<'a> Parser<'a> {
binder,
capture_clause,
constness,
coro_kind: asyncness,
coroutine_kind: asyncness,
movability,
fn_decl,
body,

View file

@ -2561,7 +2561,7 @@ impl<'a> Parser<'a> {
return Ok(FnHeader {
constness: recover_constness,
unsafety: recover_unsafety,
coro_kind: recover_asyncness,
coroutine_kind: recover_asyncness,
ext,
});
}
@ -2571,13 +2571,13 @@ impl<'a> Parser<'a> {
}
}
let coro_kind = match asyncness {
let coroutine_kind = match asyncness {
Some(CoroutineKind::Async { .. }) => asyncness,
Some(CoroutineKind::Gen { .. }) => unreachable!("asycness cannot be Gen"),
None => genness,
};
Ok(FnHeader { constness, unsafety, coro_kind, ext })
Ok(FnHeader { constness, unsafety, coroutine_kind, ext })
}
/// Parses the parameter list and result type of a function declaration.

View file

@ -598,7 +598,7 @@ impl<'a> Parser<'a> {
tokens: None,
};
let span_start = self.token.span;
let ast::FnHeader { ext, unsafety, constness, coro_kind } =
let ast::FnHeader { ext, unsafety, constness, coroutine_kind } =
self.parse_fn_front_matter(&inherited_vis, Case::Sensitive)?;
if self.may_recover() && self.token.kind == TokenKind::Lt {
self.recover_fn_ptr_with_generics(lo, &mut params, param_insertion_point)?;
@ -611,7 +611,7 @@ impl<'a> Parser<'a> {
// cover it.
self.sess.emit_err(FnPointerCannotBeConst { span: whole_span, qualifier: span });
}
if let Some(ast::CoroutineKind::Async { span, .. }) = coro_kind {
if let Some(ast::CoroutineKind::Async { span, .. }) = coroutine_kind {
self.sess.emit_err(FnPointerCannotBeAsync { span: whole_span, qualifier: span });
}
// FIXME(gen_blocks): emit a similar error for `gen fn()`