@@ -1822,9 +1822,6 @@ impl<'tcx> Visitor<'tcx> for EnsureCoroutineFieldAssignmentsNeverAlias<'_> {
1822
1822
fn check_suspend_tys < ' tcx > ( tcx : TyCtxt < ' tcx > , layout : & CoroutineLayout < ' tcx > , body : & Body < ' tcx > ) {
1823
1823
let mut linted_tys = FxHashSet :: default ( ) ;
1824
1824
1825
- // We want a user-facing param-env.
1826
- let param_env = tcx. param_env ( body. source . def_id ( ) ) ;
1827
-
1828
1825
for ( variant, yield_source_info) in
1829
1826
layout. variant_fields . iter ( ) . zip ( & layout. variant_source_info )
1830
1827
{
@@ -1838,7 +1835,7 @@ fn check_suspend_tys<'tcx>(tcx: TyCtxt<'tcx>, layout: &CoroutineLayout<'tcx>, bo
1838
1835
continue ;
1839
1836
} ;
1840
1837
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 {
1842
1839
source_span : decl. source_info . span ,
1843
1840
yield_span : yield_source_info. span ,
1844
1841
plural_len : 1 ,
@@ -1868,7 +1865,6 @@ fn check_must_not_suspend_ty<'tcx>(
1868
1865
tcx : TyCtxt < ' tcx > ,
1869
1866
ty : Ty < ' tcx > ,
1870
1867
hir_id : hir:: HirId ,
1871
- param_env : ty:: ParamEnv < ' tcx > ,
1872
1868
data : SuspendCheckData < ' _ > ,
1873
1869
) -> bool {
1874
1870
if ty. is_unit ( ) {
@@ -1883,16 +1879,13 @@ fn check_must_not_suspend_ty<'tcx>(
1883
1879
ty:: Adt ( _, args) if ty. is_box ( ) => {
1884
1880
let boxed_ty = args. type_at ( 0 ) ;
1885
1881
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 {
1887
1883
descr_pre : & format ! ( "{}boxed " , data. descr_pre) ,
1888
1884
..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
+ } )
1896
1889
}
1897
1890
ty:: Adt ( def, _) => check_must_not_suspend_def ( tcx, def. did ( ) , hir_id, data) ,
1898
1891
// FIXME: support adding the attribute to TAITs
@@ -1937,7 +1930,7 @@ fn check_must_not_suspend_ty<'tcx>(
1937
1930
let mut has_emitted = false ;
1938
1931
for ( i, ty) in fields. iter ( ) . enumerate ( ) {
1939
1932
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 {
1941
1934
descr_post,
1942
1935
..data
1943
1936
} ) {
@@ -1948,7 +1941,7 @@ fn check_must_not_suspend_ty<'tcx>(
1948
1941
}
1949
1942
ty:: Array ( ty, len) => {
1950
1943
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 {
1952
1945
descr_pre,
1953
1946
// FIXME(must_not_suspend): This is wrong. We should handle printing unevaluated consts.
1954
1947
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>(
1959
1952
// may not be considered live across the await point.
1960
1953
ty:: Ref ( _region, ty, _mutability) => {
1961
1954
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 } )
1966
1956
}
1967
1957
_ => false ,
1968
1958
}
0 commit comments