@@ -1822,9 +1822,6 @@ impl<'tcx> Visitor<'tcx> for EnsureCoroutineFieldAssignmentsNeverAlias<'_> {
18221822fn check_suspend_tys < ' tcx > ( tcx : TyCtxt < ' tcx > , layout : & CoroutineLayout < ' tcx > , body : & Body < ' tcx > ) {
18231823 let mut linted_tys = FxHashSet :: default ( ) ;
18241824
1825- // We want a user-facing param-env.
1826- let param_env = tcx. param_env ( body. source . def_id ( ) ) ;
1827-
18281825 for ( variant, yield_source_info) in
18291826 layout. variant_fields . iter ( ) . zip ( & layout. variant_source_info )
18301827 {
@@ -1838,7 +1835,7 @@ fn check_suspend_tys<'tcx>(tcx: TyCtxt<'tcx>, layout: &CoroutineLayout<'tcx>, bo
18381835 continue ;
18391836 } ;
18401837
1841- check_must_not_suspend_ty ( tcx, decl. ty , hir_id, param_env , SuspendCheckData {
1838+ check_must_not_suspend_ty ( tcx, decl. ty , hir_id, SuspendCheckData {
18421839 source_span : decl. source_info . span ,
18431840 yield_span : yield_source_info. span ,
18441841 plural_len : 1 ,
@@ -1868,7 +1865,6 @@ fn check_must_not_suspend_ty<'tcx>(
18681865 tcx : TyCtxt < ' tcx > ,
18691866 ty : Ty < ' tcx > ,
18701867 hir_id : hir:: HirId ,
1871- param_env : ty:: ParamEnv < ' tcx > ,
18721868 data : SuspendCheckData < ' _ > ,
18731869) -> bool {
18741870 if ty. is_unit ( ) {
@@ -1883,16 +1879,13 @@ fn check_must_not_suspend_ty<'tcx>(
18831879 ty:: Adt ( _, args) if ty. is_box ( ) => {
18841880 let boxed_ty = args. type_at ( 0 ) ;
18851881 let allocator_ty = args. type_at ( 1 ) ;
1886- check_must_not_suspend_ty ( tcx, boxed_ty, hir_id, param_env , SuspendCheckData {
1882+ check_must_not_suspend_ty ( tcx, boxed_ty, hir_id, SuspendCheckData {
18871883 descr_pre : & format ! ( "{}boxed " , data. descr_pre) ,
18881884 ..data
1889- } ) || check_must_not_suspend_ty (
1890- tcx,
1891- allocator_ty,
1892- hir_id,
1893- param_env,
1894- SuspendCheckData { descr_pre : & format ! ( "{}allocator " , data. descr_pre) , ..data } ,
1895- )
1885+ } ) || check_must_not_suspend_ty ( tcx, allocator_ty, hir_id, SuspendCheckData {
1886+ descr_pre : & format ! ( "{}allocator " , data. descr_pre) ,
1887+ ..data
1888+ } )
18961889 }
18971890 ty:: Adt ( def, _) => check_must_not_suspend_def ( tcx, def. did ( ) , hir_id, data) ,
18981891 // FIXME: support adding the attribute to TAITs
@@ -1937,7 +1930,7 @@ fn check_must_not_suspend_ty<'tcx>(
19371930 let mut has_emitted = false ;
19381931 for ( i, ty) in fields. iter ( ) . enumerate ( ) {
19391932 let descr_post = & format ! ( " in tuple element {i}" ) ;
1940- if check_must_not_suspend_ty ( tcx, ty, hir_id, param_env , SuspendCheckData {
1933+ if check_must_not_suspend_ty ( tcx, ty, hir_id, SuspendCheckData {
19411934 descr_post,
19421935 ..data
19431936 } ) {
@@ -1948,7 +1941,7 @@ fn check_must_not_suspend_ty<'tcx>(
19481941 }
19491942 ty:: Array ( ty, len) => {
19501943 let descr_pre = & format ! ( "{}array{} of " , data. descr_pre, plural_suffix) ;
1951- check_must_not_suspend_ty ( tcx, ty, hir_id, param_env , SuspendCheckData {
1944+ check_must_not_suspend_ty ( tcx, ty, hir_id, SuspendCheckData {
19521945 descr_pre,
19531946 // FIXME(must_not_suspend): This is wrong. We should handle printing unevaluated consts.
19541947 plural_len : len. try_to_target_usize ( tcx) . unwrap_or ( 0 ) as usize + 1 ,
@@ -1959,10 +1952,7 @@ fn check_must_not_suspend_ty<'tcx>(
19591952 // may not be considered live across the await point.
19601953 ty:: Ref ( _region, ty, _mutability) => {
19611954 let descr_pre = & format ! ( "{}reference{} to " , data. descr_pre, plural_suffix) ;
1962- check_must_not_suspend_ty ( tcx, ty, hir_id, param_env, SuspendCheckData {
1963- descr_pre,
1964- ..data
1965- } )
1955+ check_must_not_suspend_ty ( tcx, ty, hir_id, SuspendCheckData { descr_pre, ..data } )
19661956 }
19671957 _ => false ,
19681958 }
0 commit comments