@@ -349,7 +349,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
349
349
ExprKind :: Index ( base, idx, brackets_span) => {
350
350
self . check_expr_index ( base, idx, expr, brackets_span)
351
351
}
352
- ExprKind :: Yield ( value, ref src ) => self . check_expr_yield ( value, expr, src ) ,
352
+ ExprKind :: Yield ( value, _ ) => self . check_expr_yield ( value, expr) ,
353
353
hir:: ExprKind :: Err ( guar) => Ty :: new_error ( tcx, guar) ,
354
354
}
355
355
}
@@ -3162,22 +3162,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
3162
3162
& self ,
3163
3163
value : & ' tcx hir:: Expr < ' tcx > ,
3164
3164
expr : & ' tcx hir:: Expr < ' tcx > ,
3165
- src : & ' tcx hir:: YieldSource ,
3166
3165
) -> Ty < ' tcx > {
3167
3166
match self . resume_yield_tys {
3168
3167
Some ( ( resume_ty, yield_ty) ) => {
3169
3168
self . check_expr_coercible_to_type ( value, yield_ty, None ) ;
3170
3169
3171
3170
resume_ty
3172
3171
}
3173
- // Given that this `yield` expression was generated as a result of lowering a `.await`,
3174
- // we know that the yield type must be `()`; however, the context won't contain this
3175
- // information. Hence, we check the source of the yield expression here and check its
3176
- // value's type against `()` (this check should always hold).
3177
- None if src. is_await ( ) => {
3178
- self . check_expr_coercible_to_type ( value, Ty :: new_unit ( self . tcx ) , None ) ;
3179
- Ty :: new_unit ( self . tcx )
3180
- }
3181
3172
_ => {
3182
3173
self . dcx ( ) . emit_err ( YieldExprOutsideOfCoroutine { span : expr. span } ) ;
3183
3174
// Avoid expressions without types during writeback (#78653).
0 commit comments