Skip to content

Commit f23e30e

Browse files
committed
Fixup "add hir generator kind iter"
1 parent f322e60 commit f23e30e

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

compiler/rustc_hir_typeck/src/check.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,16 @@ pub(super) fn check_fn<'a, 'tcx>(
5858
if let Some(kind) = body.coroutine_kind
5959
&& can_be_coroutine.is_some()
6060
{
61-
let yield_ty = if kind == hir::CoroutineKind::Coroutine {
62-
let yield_ty = fcx.next_ty_var(TypeVariableOrigin {
63-
kind: TypeVariableOriginKind::TypeInference,
64-
span,
65-
});
66-
fcx.require_type_is_sized(yield_ty, span, traits::SizedYieldType);
67-
yield_ty
68-
} else {
69-
Ty::new_unit(tcx)
61+
let yield_ty = match kind {
62+
hir::GeneratorKind::Gen(..) | hir::CoroutineKind::Coroutine => {
63+
let yield_ty = fcx.next_ty_var(TypeVariableOrigin {
64+
kind: TypeVariableOriginKind::TypeInference,
65+
span,
66+
});
67+
fcx.require_type_is_sized(yield_ty, span, traits::SizedYieldType);
68+
yield_ty
69+
}
70+
hir::GeneratorKind::Async(..) => Ty::new_unit(tcx),
7071
};
7172

7273
// Resume type defaults to `()` if the coroutine has no argument.

0 commit comments

Comments
 (0)