@@ -463,8 +463,10 @@ pub fn check_must_not_suspend_ty<'tcx>(
463
463
plural_len : usize ,
464
464
) -> bool {
465
465
if ty. is_unit ( )
466
+ // FIXME: should this check `is_ty_uninhabited_from`. This query is not available in this stage
467
+ // of typeck (before ReVar and RePlaceholder are removed), but may remove noise, like in
468
+ // `must_use`
466
469
// || fcx.tcx.is_ty_uninhabited_from(fcx.tcx.parent_module(hir_id).to_def_id(), ty, fcx.param_env)
467
- // FIXME: should this check is_ty_uninhabited_from
468
470
{
469
471
return true ;
470
472
}
@@ -496,6 +498,7 @@ pub fn check_must_not_suspend_ty<'tcx>(
496
498
descr_pre,
497
499
descr_post,
498
500
) ,
501
+ // FIXME: support adding the attribute to TAITs
499
502
ty:: Opaque ( def, _) => {
500
503
let mut has_emitted = false ;
501
504
for & ( predicate, _) in fcx. tcx . explicit_item_bounds ( def) {
@@ -604,18 +607,18 @@ fn check_must_not_suspend_def(
604
607
) ;
605
608
let mut err = lint. build ( & msg) ;
606
609
610
+ // add span pointing to the offending yield/await
611
+ err. span_label ( yield_span, "the value is held across this yield point" ) ;
612
+
607
613
// Add optional reason note
608
614
if let Some ( note) = attr. value_str ( ) {
609
- err. note ( & note. as_str ( ) ) ;
615
+ err. span_note ( source_span , & note. as_str ( ) ) ;
610
616
}
611
617
612
- // add span pointing to the offending yield/await)
613
- err. span_label ( yield_span, "The value is held across this yield point" ) ;
614
-
615
618
// Add some quick suggestions on what to do
616
619
err. span_help (
617
620
source_span,
618
- "`drop` this value before the yield point, or use a block (`{ ... }`) \"
621
+ "`drop` this value before the yield point, or use a block (`{ ... }`) \
619
622
to shrink its scope",
620
623
) ;
621
624
0 commit comments