@@ -1448,31 +1448,30 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
1448
1448
} ) ;
1449
1449
} ;
1450
1450
1451
- typeck_results
1451
+ if let Some ( cause ) = typeck_results
1452
1452
. generator_interior_types
1453
1453
. iter ( )
1454
1454
. find ( |ty:: GeneratorInteriorTypeCause { ty, .. } | ty_matches ( ty) )
1455
- . map ( |cause| {
1456
- // Check to see if any awaited expressions have the target type.
1457
- let from_awaited_ty = visitor
1458
- . awaits
1459
- . into_iter ( )
1460
- . map ( |id| hir. expect_expr ( id) )
1461
- . find ( |await_expr| {
1462
- let ty = typeck_results. expr_ty_adjusted ( & await_expr) ;
1463
- debug ! (
1464
- "maybe_note_obligation_cause_for_async_await: await_expr={:?}" ,
1465
- await_expr
1466
- ) ;
1467
- ty_matches ( ty)
1468
- } )
1469
- . map ( |expr| expr. span ) ;
1470
- let ty:: GeneratorInteriorTypeCause { span, scope_span, yield_span, expr, .. } =
1471
- cause;
1455
+ {
1456
+ // Check to see if any awaited expressions have the target type.
1457
+ let from_awaited_ty = visitor
1458
+ . awaits
1459
+ . into_iter ( )
1460
+ . map ( |id| hir. expect_expr ( id) )
1461
+ . find ( |await_expr| {
1462
+ let ty = typeck_results. expr_ty_adjusted ( & await_expr) ;
1463
+ debug ! (
1464
+ "maybe_note_obligation_cause_for_async_await: await_expr={:?}" ,
1465
+ await_expr
1466
+ ) ;
1467
+ ty_matches ( ty)
1468
+ } )
1469
+ . map ( |expr| expr. span ) ;
1470
+ let ty:: GeneratorInteriorTypeCause { span, scope_span, yield_span, expr, .. } = cause;
1472
1471
1473
- interior_or_upvar_span = Some ( GeneratorInteriorOrUpvar :: Interior ( * span) ) ;
1474
- interior_extra_info = Some ( ( * scope_span, * yield_span, * expr, from_awaited_ty) ) ;
1475
- } ) ;
1472
+ interior_or_upvar_span = Some ( GeneratorInteriorOrUpvar :: Interior ( * span) ) ;
1473
+ interior_extra_info = Some ( ( * scope_span, * yield_span, * expr, from_awaited_ty) ) ;
1474
+ } ;
1476
1475
1477
1476
debug ! (
1478
1477
"maybe_note_obligation_cause_for_async_await: interior_or_upvar={:?} \
0 commit comments