@@ -2358,7 +2358,7 @@ impl<'tcx> Ty<'tcx> {
23582358 ty:: Adt ( adt_def, _) => {
23592359 assert ! ( adt_def. is_union( ) ) ;
23602360
2361- let surface_drop = self . surface_async_dropper_ty ( tcx, param_env ) . unwrap ( ) ;
2361+ let surface_drop = self . surface_async_dropper_ty ( tcx) . unwrap ( ) ;
23622362
23632363 Ty :: async_destructor_combinator ( tcx, LangItem :: AsyncDropFuse )
23642364 . instantiate ( tcx, & [ surface_drop. into ( ) ] )
@@ -2408,7 +2408,7 @@ impl<'tcx> Ty<'tcx> {
24082408 } )
24092409 . unwrap ( ) ;
24102410
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) {
24122412 Ty :: async_destructor_combinator ( tcx, LangItem :: AsyncDropChain )
24132413 . instantiate ( tcx, & [ dropper_ty. into ( ) , variants_dtor. into ( ) ] )
24142414 } else {
@@ -2419,21 +2419,13 @@ impl<'tcx> Ty<'tcx> {
24192419 . instantiate ( tcx, & [ dtor. into ( ) ] )
24202420 }
24212421
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 ( ) ] ) )
24372429 }
24382430
24392431 fn async_destructor_combinator (
0 commit comments