@@ -1991,7 +1991,7 @@ impl<'tcx> Ty<'tcx> {
19911991 ty:: Adt ( adt_def, _) => {
19921992 assert ! ( adt_def. is_union( ) ) ;
19931993
1994- let surface_drop = self . surface_async_dropper_ty ( tcx, param_env ) . unwrap ( ) ;
1994+ let surface_drop = self . surface_async_dropper_ty ( tcx) . unwrap ( ) ;
19951995
19961996 Ty :: async_destructor_combinator ( tcx, LangItem :: AsyncDropFuse )
19971997 . instantiate ( tcx, & [ surface_drop. into ( ) ] )
@@ -2041,7 +2041,7 @@ impl<'tcx> Ty<'tcx> {
20412041 } )
20422042 . unwrap ( ) ;
20432043
2044- let dtor = if let Some ( dropper_ty) = self . surface_async_dropper_ty ( tcx, param_env ) {
2044+ let dtor = if let Some ( dropper_ty) = self . surface_async_dropper_ty ( tcx) {
20452045 Ty :: async_destructor_combinator ( tcx, LangItem :: AsyncDropChain )
20462046 . instantiate ( tcx, & [ dropper_ty. into ( ) , variants_dtor. into ( ) ] )
20472047 } else {
@@ -2052,21 +2052,13 @@ impl<'tcx> Ty<'tcx> {
20522052 . instantiate ( tcx, & [ dtor. into ( ) ] )
20532053 }
20542054
2055- fn surface_async_dropper_ty (
2056- self ,
2057- tcx : TyCtxt < ' tcx > ,
2058- param_env : ParamEnv < ' tcx > ,
2059- ) -> Option < Ty < ' tcx > > {
2060- if self . has_surface_async_drop ( tcx, param_env) {
2061- Some ( LangItem :: SurfaceAsyncDropInPlace )
2062- } else if self . has_surface_drop ( tcx, param_env) {
2063- Some ( LangItem :: AsyncDropSurfaceDropInPlace )
2064- } else {
2065- None
2066- }
2067- . map ( |dropper| {
2068- Ty :: async_destructor_combinator ( tcx, dropper) . instantiate ( tcx, & [ self . into ( ) ] )
2069- } )
2055+ fn surface_async_dropper_ty ( self , tcx : TyCtxt < ' tcx > ) -> Option < Ty < ' tcx > > {
2056+ let adt_def = self . ty_adt_def ( ) ?;
2057+ let dropper = adt_def
2058+ . async_destructor ( tcx)
2059+ . map ( |_| LangItem :: SurfaceAsyncDropInPlace )
2060+ . or_else ( || adt_def. destructor ( tcx) . map ( |_| LangItem :: AsyncDropSurfaceDropInPlace ) ) ?;
2061+ Some ( Ty :: async_destructor_combinator ( tcx, dropper) . instantiate ( tcx, & [ self . into ( ) ] ) )
20702062 }
20712063
20722064 fn async_destructor_combinator (
0 commit comments