@@ -124,7 +124,6 @@ impl<'a, 'tcx> InteriorVisitor<'a, 'tcx> {
124124
125125 check_must_not_suspend_ty (
126126 self . fcx ,
127- ty:: ParamEnv :: empty ( ) ,
128127 ty,
129128 hir_id,
130129 expr,
@@ -454,7 +453,6 @@ impl<'a, 'tcx> Visitor<'tcx> for ArmPatCollector<'a> {
454453// for creating must_use diagnostics
455454pub fn check_must_not_suspend_ty < ' tcx > (
456455 fcx : & FnCtxt < ' _ , ' tcx > ,
457- param_env : ty:: ParamEnv < ' tcx > ,
458456 ty : Ty < ' tcx > ,
459457 hir_id : HirId ,
460458 expr : Option < & ' tcx Expr < ' tcx > > ,
@@ -464,8 +462,10 @@ pub fn check_must_not_suspend_ty<'tcx>(
464462 descr_post : & str ,
465463 plural_len : usize ,
466464) -> bool {
465+ debug ! ( "FOUND TYPE: {:?}" , ty) ;
467466 if ty. is_unit ( )
468- || fcx. tcx . is_ty_uninhabited_from ( fcx. tcx . parent_module ( hir_id) . to_def_id ( ) , ty, param_env)
467+ // || fcx.tcx.is_ty_uninhabited_from(fcx.tcx.parent_module(hir_id).to_def_id(), ty, fcx.param_env)
468+ // FIXME: should this check is_ty_uninhabited_from
469469 {
470470 return true ;
471471 }
@@ -478,7 +478,6 @@ pub fn check_must_not_suspend_ty<'tcx>(
478478 let descr_pre = & format ! ( "{}boxed " , descr_pre) ;
479479 check_must_not_suspend_ty (
480480 fcx,
481- param_env,
482481 boxed_ty,
483482 hir_id,
484483 expr,
@@ -547,36 +546,31 @@ pub fn check_must_not_suspend_ty<'tcx>(
547546 }
548547 ty:: Tuple ( ref tys) => {
549548 let mut has_emitted = false ;
550- /*
551- let spans = if let hir::ExprKind::Tup(comps) = &expr.kind {
549+ let spans = if let Some ( hir:: ExprKind :: Tup ( comps) ) = expr. map ( |e| & e. kind ) {
552550 debug_assert_eq ! ( comps. len( ) , tys. len( ) ) ;
553551 comps. iter ( ) . map ( |e| e. span ) . collect ( )
554552 } else {
555553 vec ! [ ]
556554 } ;
557- */
558- let spans = vec ! [ ] ;
559555 for ( i, ty) in tys. iter ( ) . map ( |k| k. expect_ty ( ) ) . enumerate ( ) {
560556 let descr_post = & format ! ( " in tuple element {}" , i) ;
561557 let span = * spans. get ( i) . unwrap_or ( & source_span) ;
562558 if check_must_not_suspend_ty (
563- fcx, param_env, ty, hir_id, expr, span, yield_span, descr_pre, descr_post,
564- plural_len,
559+ fcx, ty, hir_id, expr, span, yield_span, descr_pre, descr_post, plural_len,
565560 ) {
566561 has_emitted = true ;
567562 }
568563 }
569564 has_emitted
570565 }
571- ty:: Array ( ty, len) => match len. try_eval_usize ( fcx. tcx , param_env) {
566+ ty:: Array ( ty, len) => match len. try_eval_usize ( fcx. tcx , fcx . param_env ) {
572567 // If the array is empty we don't lint, to avoid false positives
573568 Some ( 0 ) | None => false ,
574569 // If the array is definitely non-empty, we can do `#[must_use]` checking.
575570 Some ( n) => {
576571 let descr_pre = & format ! ( "{}array{} of " , descr_pre, plural_suffix, ) ;
577572 check_must_not_suspend_ty (
578573 fcx,
579- param_env,
580574 ty,
581575 hir_id,
582576 expr,
0 commit comments