File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed
compiler/rustc_hir_typeck/src Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -58,15 +58,16 @@ pub(super) fn check_fn<'a, 'tcx>(
58
58
if let Some ( kind) = body. coroutine_kind
59
59
&& can_be_coroutine. is_some ( )
60
60
{
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) ,
70
71
} ;
71
72
72
73
// Resume type defaults to `()` if the coroutine has no argument.
You can’t perform that action at this time.
0 commit comments