@@ -1261,31 +1261,31 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
1261
1261
ty_matches ( ty)
1262
1262
} )
1263
1263
. map ( |expr| expr. span ) ;
1264
- let ty:: GeneratorInteriorTypeCause { span, scope_span, await_span , expr, .. } =
1264
+ let ty:: GeneratorInteriorTypeCause { span, scope_span, yield_span , expr, .. } =
1265
1265
cause;
1266
1266
(
1267
1267
span,
1268
1268
source_map. span_to_snippet ( * span) ,
1269
1269
scope_span,
1270
- await_span ,
1270
+ yield_span ,
1271
1271
expr,
1272
1272
from_awaited_ty,
1273
1273
)
1274
1274
} ) ;
1275
1275
1276
1276
debug ! (
1277
1277
"maybe_note_obligation_cause_for_async_await: target_ty={:?} \
1278
- generator_interior_types={:?} target_span={:?} await_span={:?} ",
1279
- target_ty, tables. generator_interior_types, target_span, await_span
1278
+ generator_interior_types={:?} target_span={:?}",
1279
+ target_ty, tables. generator_interior_types, target_span
1280
1280
) ;
1281
- if let Some ( ( target_span, Ok ( snippet) , scope_span, await_span , expr, from_awaited_ty) ) =
1281
+ if let Some ( ( target_span, Ok ( snippet) , scope_span, yield_span , expr, from_awaited_ty) ) =
1282
1282
target_span
1283
1283
{
1284
1284
self . note_obligation_cause_for_async_await (
1285
1285
err,
1286
1286
* target_span,
1287
1287
scope_span,
1288
- await_span ,
1288
+ * yield_span ,
1289
1289
* expr,
1290
1290
snippet,
1291
1291
generator_body,
@@ -1310,7 +1310,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
1310
1310
err : & mut DiagnosticBuilder < ' _ > ,
1311
1311
target_span : Span ,
1312
1312
scope_span : & Option < Span > ,
1313
- await_span : Span ,
1313
+ yield_span : Span ,
1314
1314
expr : Option < hir:: HirId > ,
1315
1315
snippet : String ,
1316
1316
inner_generator_body : Option < & hir:: Body < ' _ > > ,
@@ -1386,6 +1386,12 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
1386
1386
if let Some ( await_span) = from_awaited_ty {
1387
1387
// The type causing this obligation is one being awaited at await_span.
1388
1388
let mut span = MultiSpan :: from_span ( await_span) ;
1389
+
1390
+ span. push_span_label (
1391
+ await_span,
1392
+ format ! ( "await occurs here on type `{}`, which {}" , target_ty, trait_explanation) ,
1393
+ ) ;
1394
+
1389
1395
err. span_note (
1390
1396
span,
1391
1397
& format ! (
@@ -1399,9 +1405,9 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
1399
1405
"note_obligation_cause_for_async_await generator_interior_types: {:#?}" ,
1400
1406
tables. generator_interior_types
1401
1407
) ;
1402
- let mut span = MultiSpan :: from_span ( await_span ) ;
1408
+ let mut span = MultiSpan :: from_span ( yield_span ) ;
1403
1409
span. push_span_label (
1404
- await_span ,
1410
+ yield_span ,
1405
1411
format ! ( "{} occurs here, with `{}` maybe used later" , await_or_yield, snippet) ,
1406
1412
) ;
1407
1413
0 commit comments