@@ -2162,7 +2162,7 @@ impl<'tcx> Ty<'tcx> {
21622162 ty:: Adt ( adt_def, _) => {
21632163 assert ! ( adt_def. is_union( ) ) ;
21642164
2165- let surface_drop = self . surface_async_dropper_ty ( tcx, param_env ) . unwrap ( ) ;
2165+ let surface_drop = self . surface_async_dropper_ty ( tcx) . unwrap ( ) ;
21662166
21672167 Ty :: async_destructor_combinator ( tcx, LangItem :: AsyncDropFuse )
21682168 . instantiate ( tcx, & [ surface_drop. into ( ) ] )
@@ -2212,7 +2212,7 @@ impl<'tcx> Ty<'tcx> {
22122212 } )
22132213 . unwrap ( ) ;
22142214
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) {
22162216 Ty :: async_destructor_combinator ( tcx, LangItem :: AsyncDropChain )
22172217 . instantiate ( tcx, & [ dropper_ty. into ( ) , variants_dtor. into ( ) ] )
22182218 } else {
@@ -2223,21 +2223,13 @@ impl<'tcx> Ty<'tcx> {
22232223 . instantiate ( tcx, & [ dtor. into ( ) ] )
22242224 }
22252225
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 ( ) ] ) )
22412233 }
22422234
22432235 fn async_destructor_combinator (
0 commit comments