@@ -463,8 +463,10 @@ pub fn check_must_not_suspend_ty<'tcx>(
463463 plural_len : usize ,
464464) -> bool {
465465 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`
466469 // || 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
468470 {
469471 return true ;
470472 }
@@ -496,6 +498,7 @@ pub fn check_must_not_suspend_ty<'tcx>(
496498 descr_pre,
497499 descr_post,
498500 ) ,
501+ // FIXME: support adding the attribute to TAITs
499502 ty:: Opaque ( def, _) => {
500503 let mut has_emitted = false ;
501504 for & ( predicate, _) in fcx. tcx . explicit_item_bounds ( def) {
@@ -604,18 +607,18 @@ fn check_must_not_suspend_def(
604607 ) ;
605608 let mut err = lint. build ( & msg) ;
606609
610+ // add span pointing to the offending yield/await
611+ err. span_label ( yield_span, "the value is held across this yield point" ) ;
612+
607613 // Add optional reason note
608614 if let Some ( note) = attr. value_str ( ) {
609- err. note ( & note. as_str ( ) ) ;
615+ err. span_note ( source_span , & note. as_str ( ) ) ;
610616 }
611617
612- // add span pointing to the offending yield/await)
613- err. span_label ( yield_span, "The value is held across this yield point" ) ;
614-
615618 // Add some quick suggestions on what to do
616619 err. span_help (
617620 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 (`{ ... }`) \
619622 to shrink its scope",
620623 ) ;
621624
0 commit comments