@@ -124,7 +124,6 @@ impl<'a, 'tcx> InteriorVisitor<'a, 'tcx> {
124
124
125
125
check_must_not_suspend_ty (
126
126
self . fcx ,
127
- ty:: ParamEnv :: empty ( ) ,
128
127
ty,
129
128
hir_id,
130
129
expr,
@@ -454,7 +453,6 @@ impl<'a, 'tcx> Visitor<'tcx> for ArmPatCollector<'a> {
454
453
// for creating must_use diagnostics
455
454
pub fn check_must_not_suspend_ty < ' tcx > (
456
455
fcx : & FnCtxt < ' _ , ' tcx > ,
457
- param_env : ty:: ParamEnv < ' tcx > ,
458
456
ty : Ty < ' tcx > ,
459
457
hir_id : HirId ,
460
458
expr : Option < & ' tcx Expr < ' tcx > > ,
@@ -464,8 +462,10 @@ pub fn check_must_not_suspend_ty<'tcx>(
464
462
descr_post : & str ,
465
463
plural_len : usize ,
466
464
) -> bool {
465
+ debug ! ( "FOUND TYPE: {:?}" , ty) ;
467
466
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
469
469
{
470
470
return true ;
471
471
}
@@ -478,7 +478,6 @@ pub fn check_must_not_suspend_ty<'tcx>(
478
478
let descr_pre = & format ! ( "{}boxed " , descr_pre) ;
479
479
check_must_not_suspend_ty (
480
480
fcx,
481
- param_env,
482
481
boxed_ty,
483
482
hir_id,
484
483
expr,
@@ -547,36 +546,31 @@ pub fn check_must_not_suspend_ty<'tcx>(
547
546
}
548
547
ty:: Tuple ( ref tys) => {
549
548
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 ) {
552
550
debug_assert_eq ! ( comps. len( ) , tys. len( ) ) ;
553
551
comps. iter ( ) . map ( |e| e. span ) . collect ( )
554
552
} else {
555
553
vec ! [ ]
556
554
} ;
557
- */
558
- let spans = vec ! [ ] ;
559
555
for ( i, ty) in tys. iter ( ) . map ( |k| k. expect_ty ( ) ) . enumerate ( ) {
560
556
let descr_post = & format ! ( " in tuple element {}" , i) ;
561
557
let span = * spans. get ( i) . unwrap_or ( & source_span) ;
562
558
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,
565
560
) {
566
561
has_emitted = true ;
567
562
}
568
563
}
569
564
has_emitted
570
565
}
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 ) {
572
567
// If the array is empty we don't lint, to avoid false positives
573
568
Some ( 0 ) | None => false ,
574
569
// If the array is definitely non-empty, we can do `#[must_use]` checking.
575
570
Some ( n) => {
576
571
let descr_pre = & format ! ( "{}array{} of " , descr_pre, plural_suffix, ) ;
577
572
check_must_not_suspend_ty (
578
573
fcx,
579
- param_env,
580
574
ty,
581
575
hir_id,
582
576
expr,
0 commit comments