@@ -1974,7 +1974,7 @@ impl<'tcx> Ty<'tcx> {
19741974 ty:: Adt ( adt_def, _) => {
19751975 assert ! ( adt_def. is_union( ) ) ;
19761976
1977- let surface_drop = self . surface_async_dropper_ty ( tcx, param_env ) . unwrap ( ) ;
1977+ let surface_drop = self . surface_async_dropper_ty ( tcx) . unwrap ( ) ;
19781978
19791979 Ty :: async_destructor_combinator ( tcx, LangItem :: AsyncDropFuse )
19801980 . instantiate ( tcx, & [ surface_drop. into ( ) ] )
@@ -2024,7 +2024,7 @@ impl<'tcx> Ty<'tcx> {
20242024 } )
20252025 . unwrap ( ) ;
20262026
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) {
20282028 Ty :: async_destructor_combinator ( tcx, LangItem :: AsyncDropChain )
20292029 . instantiate ( tcx, & [ dropper_ty. into ( ) , variants_dtor. into ( ) ] )
20302030 } else {
@@ -2035,21 +2035,13 @@ impl<'tcx> Ty<'tcx> {
20352035 . instantiate ( tcx, & [ dtor. into ( ) ] )
20362036 }
20372037
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 ( ) ] ) )
20532045 }
20542046
20552047 fn async_destructor_combinator (
0 commit comments