@@ -1974,7 +1974,7 @@ impl<'tcx> Ty<'tcx> {
1974
1974
ty:: Adt ( adt_def, _) => {
1975
1975
assert ! ( adt_def. is_union( ) ) ;
1976
1976
1977
- let surface_drop = self . surface_async_dropper_ty ( tcx, param_env ) . unwrap ( ) ;
1977
+ let surface_drop = self . surface_async_dropper_ty ( tcx) . unwrap ( ) ;
1978
1978
1979
1979
Ty :: async_destructor_combinator ( tcx, LangItem :: AsyncDropFuse )
1980
1980
. instantiate ( tcx, & [ surface_drop. into ( ) ] )
@@ -2024,7 +2024,7 @@ impl<'tcx> Ty<'tcx> {
2024
2024
} )
2025
2025
. unwrap ( ) ;
2026
2026
2027
- let dtor = if let Some ( dropper_ty) = self . surface_async_dropper_ty ( tcx, param_env ) {
2027
+ let dtor = if let Some ( dropper_ty) = self . surface_async_dropper_ty ( tcx) {
2028
2028
Ty :: async_destructor_combinator ( tcx, LangItem :: AsyncDropChain )
2029
2029
. instantiate ( tcx, & [ dropper_ty. into ( ) , variants_dtor. into ( ) ] )
2030
2030
} else {
@@ -2035,21 +2035,13 @@ impl<'tcx> Ty<'tcx> {
2035
2035
. instantiate ( tcx, & [ dtor. into ( ) ] )
2036
2036
}
2037
2037
2038
- fn surface_async_dropper_ty (
2039
- self ,
2040
- tcx : TyCtxt < ' tcx > ,
2041
- param_env : ParamEnv < ' tcx > ,
2042
- ) -> Option < Ty < ' tcx > > {
2043
- if self . has_surface_async_drop ( tcx, param_env) {
2044
- Some ( LangItem :: SurfaceAsyncDropInPlace )
2045
- } else if self . has_surface_drop ( tcx, param_env) {
2046
- Some ( LangItem :: AsyncDropSurfaceDropInPlace )
2047
- } else {
2048
- None
2049
- }
2050
- . map ( |dropper| {
2051
- Ty :: async_destructor_combinator ( tcx, dropper) . instantiate ( tcx, & [ self . into ( ) ] )
2052
- } )
2038
+ fn surface_async_dropper_ty ( self , tcx : TyCtxt < ' tcx > ) -> Option < Ty < ' tcx > > {
2039
+ let adt_def = self . ty_adt_def ( ) ?;
2040
+ let dropper = adt_def
2041
+ . async_destructor ( tcx)
2042
+ . map ( |_| LangItem :: SurfaceAsyncDropInPlace )
2043
+ . or_else ( || adt_def. destructor ( tcx) . map ( |_| LangItem :: AsyncDropSurfaceDropInPlace ) ) ?;
2044
+ Some ( Ty :: async_destructor_combinator ( tcx, dropper) . instantiate ( tcx, & [ self . into ( ) ] ) )
2053
2045
}
2054
2046
2055
2047
fn async_destructor_combinator (
0 commit comments