@@ -127,7 +127,7 @@ pub trait InferCtxtExt<'tcx> {
127
127
err : & mut DiagnosticBuilder < ' _ > ,
128
128
target_span : Span ,
129
129
scope_span : & Option < Span > ,
130
- await_span : Span ,
130
+ yield_span : Option < Span > ,
131
131
expr : Option < hir:: HirId > ,
132
132
snippet : String ,
133
133
inner_generator_body : Option < & hir:: Body < ' _ > > ,
@@ -1353,7 +1353,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
1353
1353
err : & mut DiagnosticBuilder < ' _ > ,
1354
1354
target_span : Span ,
1355
1355
scope_span : & Option < Span > ,
1356
- yield_span : Span ,
1356
+ yield_span : Option < Span > ,
1357
1357
expr : Option < hir:: HirId > ,
1358
1358
snippet : String ,
1359
1359
inner_generator_body : Option < & hir:: Body < ' _ > > ,
@@ -1446,11 +1446,13 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
1446
1446
"note_obligation_cause_for_async_await generator_interior_types: {:#?}" ,
1447
1447
tables. generator_interior_types
1448
1448
) ;
1449
- let mut span = MultiSpan :: from_span ( yield_span) ;
1450
- span. push_span_label (
1451
- yield_span,
1452
- format ! ( "{} occurs here, with `{}` maybe used later" , await_or_yield, snippet) ,
1453
- ) ;
1449
+
1450
+ if let Some ( yield_span) = yield_span {
1451
+ let mut span = MultiSpan :: from_span ( yield_span) ;
1452
+ span. push_span_label (
1453
+ yield_span,
1454
+ format ! ( "{} occurs here, with `{}` maybe used later" , await_or_yield, snippet) ,
1455
+ ) ;
1454
1456
1455
1457
span. push_span_label (
1456
1458
target_span,
0 commit comments