@@ -2162,7 +2162,7 @@ impl<'tcx> Ty<'tcx> {
2162
2162
ty:: Adt ( adt_def, _) => {
2163
2163
assert ! ( adt_def. is_union( ) ) ;
2164
2164
2165
- let surface_drop = self . surface_async_dropper_ty ( tcx, param_env ) . unwrap ( ) ;
2165
+ let surface_drop = self . surface_async_dropper_ty ( tcx) . unwrap ( ) ;
2166
2166
2167
2167
Ty :: async_destructor_combinator ( tcx, LangItem :: AsyncDropFuse )
2168
2168
. instantiate ( tcx, & [ surface_drop. into ( ) ] )
@@ -2212,7 +2212,7 @@ impl<'tcx> Ty<'tcx> {
2212
2212
} )
2213
2213
. unwrap ( ) ;
2214
2214
2215
- let dtor = if let Some ( dropper_ty) = self . surface_async_dropper_ty ( tcx, param_env ) {
2215
+ let dtor = if let Some ( dropper_ty) = self . surface_async_dropper_ty ( tcx) {
2216
2216
Ty :: async_destructor_combinator ( tcx, LangItem :: AsyncDropChain )
2217
2217
. instantiate ( tcx, & [ dropper_ty. into ( ) , variants_dtor. into ( ) ] )
2218
2218
} else {
@@ -2223,21 +2223,13 @@ impl<'tcx> Ty<'tcx> {
2223
2223
. instantiate ( tcx, & [ dtor. into ( ) ] )
2224
2224
}
2225
2225
2226
- fn surface_async_dropper_ty (
2227
- self ,
2228
- tcx : TyCtxt < ' tcx > ,
2229
- param_env : ParamEnv < ' tcx > ,
2230
- ) -> Option < Ty < ' tcx > > {
2231
- if self . has_surface_async_drop ( tcx, param_env) {
2232
- Some ( LangItem :: SurfaceAsyncDropInPlace )
2233
- } else if self . has_surface_drop ( tcx, param_env) {
2234
- Some ( LangItem :: AsyncDropSurfaceDropInPlace )
2235
- } else {
2236
- None
2237
- }
2238
- . map ( |dropper| {
2239
- Ty :: async_destructor_combinator ( tcx, dropper) . instantiate ( tcx, & [ self . into ( ) ] )
2240
- } )
2226
+ fn surface_async_dropper_ty ( self , tcx : TyCtxt < ' tcx > ) -> Option < Ty < ' tcx > > {
2227
+ let adt_def = self . ty_adt_def ( ) ?;
2228
+ let dropper = adt_def
2229
+ . async_destructor ( tcx)
2230
+ . map ( |_| LangItem :: SurfaceAsyncDropInPlace )
2231
+ . or_else ( || adt_def. destructor ( tcx) . map ( |_| LangItem :: AsyncDropSurfaceDropInPlace ) ) ?;
2232
+ Some ( Ty :: async_destructor_combinator ( tcx, dropper) . instantiate ( tcx, & [ self . into ( ) ] ) )
2241
2233
}
2242
2234
2243
2235
fn async_destructor_combinator (
0 commit comments