@@ -2358,7 +2358,7 @@ impl<'tcx> Ty<'tcx> {
2358
2358
ty:: Adt ( adt_def, _) => {
2359
2359
assert ! ( adt_def. is_union( ) ) ;
2360
2360
2361
- let surface_drop = self . surface_async_dropper_ty ( tcx, param_env ) . unwrap ( ) ;
2361
+ let surface_drop = self . surface_async_dropper_ty ( tcx) . unwrap ( ) ;
2362
2362
2363
2363
Ty :: async_destructor_combinator ( tcx, LangItem :: AsyncDropFuse )
2364
2364
. instantiate ( tcx, & [ surface_drop. into ( ) ] )
@@ -2408,7 +2408,7 @@ impl<'tcx> Ty<'tcx> {
2408
2408
} )
2409
2409
. unwrap ( ) ;
2410
2410
2411
- let dtor = if let Some ( dropper_ty) = self . surface_async_dropper_ty ( tcx, param_env ) {
2411
+ let dtor = if let Some ( dropper_ty) = self . surface_async_dropper_ty ( tcx) {
2412
2412
Ty :: async_destructor_combinator ( tcx, LangItem :: AsyncDropChain )
2413
2413
. instantiate ( tcx, & [ dropper_ty. into ( ) , variants_dtor. into ( ) ] )
2414
2414
} else {
@@ -2419,21 +2419,13 @@ impl<'tcx> Ty<'tcx> {
2419
2419
. instantiate ( tcx, & [ dtor. into ( ) ] )
2420
2420
}
2421
2421
2422
- fn surface_async_dropper_ty (
2423
- self ,
2424
- tcx : TyCtxt < ' tcx > ,
2425
- param_env : ParamEnv < ' tcx > ,
2426
- ) -> Option < Ty < ' tcx > > {
2427
- if self . has_surface_async_drop ( tcx, param_env) {
2428
- Some ( LangItem :: SurfaceAsyncDropInPlace )
2429
- } else if self . has_surface_drop ( tcx, param_env) {
2430
- Some ( LangItem :: AsyncDropSurfaceDropInPlace )
2431
- } else {
2432
- None
2433
- }
2434
- . map ( |dropper| {
2435
- Ty :: async_destructor_combinator ( tcx, dropper) . instantiate ( tcx, & [ self . into ( ) ] )
2436
- } )
2422
+ fn surface_async_dropper_ty ( self , tcx : TyCtxt < ' tcx > ) -> Option < Ty < ' tcx > > {
2423
+ let adt_def = self . ty_adt_def ( ) ?;
2424
+ let dropper = adt_def
2425
+ . async_destructor ( tcx)
2426
+ . map ( |_| LangItem :: SurfaceAsyncDropInPlace )
2427
+ . or_else ( || adt_def. destructor ( tcx) . map ( |_| LangItem :: AsyncDropSurfaceDropInPlace ) ) ?;
2428
+ Some ( Ty :: async_destructor_combinator ( tcx, dropper) . instantiate ( tcx, & [ self . into ( ) ] ) )
2437
2429
}
2438
2430
2439
2431
fn async_destructor_combinator (
0 commit comments