Rename CoroutineKind::Gen to ::Coroutine

This commit is contained in:
Oli Scherer
2023-10-20 09:02:22 +00:00
parent e96ce20b34
commit 2d91c76d5d
14 changed files with 29 additions and 25 deletions

View File

@@ -712,7 +712,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
let full_span = expr.span.to(await_kw_span);
match self.coroutine_kind {
Some(hir::CoroutineKind::Async(_)) => {}
Some(hir::CoroutineKind::Gen) | None => {
Some(hir::CoroutineKind::Coroutine) | None => {
self.tcx.sess.emit_err(AwaitOnlyInAsyncFnAndBlocks {
await_kw_span,
item_span: self.current_item,
@@ -930,7 +930,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
movability: Movability,
) -> Option<hir::Movability> {
match coroutine_kind {
Some(hir::CoroutineKind::Gen) => {
Some(hir::CoroutineKind::Coroutine) => {
if decl.inputs.len() > 1 {
self.tcx.sess.emit_err(CoroutineTooManyParameters { fn_decl_span });
}
@@ -1445,11 +1445,11 @@ impl<'hir> LoweringContext<'_, 'hir> {
fn lower_expr_yield(&mut self, span: Span, opt_expr: Option<&Expr>) -> hir::ExprKind<'hir> {
match self.coroutine_kind {
Some(hir::CoroutineKind::Gen) => {}
Some(hir::CoroutineKind::Coroutine) => {}
Some(hir::CoroutineKind::Async(_)) => {
self.tcx.sess.emit_err(AsyncCoroutinesNotSupported { span });
}
None => self.coroutine_kind = Some(hir::CoroutineKind::Gen),
None => self.coroutine_kind = Some(hir::CoroutineKind::Coroutine),
}
let expr =