@@ -1935,7 +1935,7 @@ impl<'tcx> Ty<'tcx> {
19351935 ty:: Adt ( adt_def, _) => {
19361936 assert ! ( adt_def. is_union( ) ) ;
19371937
1938- let surface_drop = self . surface_async_dropper_ty ( tcx, param_env ) . unwrap ( ) ;
1938+ let surface_drop = self . surface_async_dropper_ty ( tcx) . unwrap ( ) ;
19391939
19401940 Ty :: async_destructor_combinator ( tcx, LangItem :: AsyncDropFuse )
19411941 . instantiate ( tcx, & [ surface_drop. into ( ) ] )
@@ -1985,7 +1985,7 @@ impl<'tcx> Ty<'tcx> {
19851985 } )
19861986 . unwrap ( ) ;
19871987
1988- let dtor = if let Some ( dropper_ty) = self . surface_async_dropper_ty ( tcx, param_env ) {
1988+ let dtor = if let Some ( dropper_ty) = self . surface_async_dropper_ty ( tcx) {
19891989 Ty :: async_destructor_combinator ( tcx, LangItem :: AsyncDropChain )
19901990 . instantiate ( tcx, & [ dropper_ty. into ( ) , variants_dtor. into ( ) ] )
19911991 } else {
@@ -1996,21 +1996,13 @@ impl<'tcx> Ty<'tcx> {
19961996 . instantiate ( tcx, & [ dtor. into ( ) ] )
19971997 }
19981998
1999- fn surface_async_dropper_ty (
2000- self ,
2001- tcx : TyCtxt < ' tcx > ,
2002- param_env : ParamEnv < ' tcx > ,
2003- ) -> Option < Ty < ' tcx > > {
2004- if self . has_surface_async_drop ( tcx, param_env) {
2005- Some ( LangItem :: SurfaceAsyncDropInPlace )
2006- } else if self . has_surface_drop ( tcx, param_env) {
2007- Some ( LangItem :: AsyncDropSurfaceDropInPlace )
2008- } else {
2009- None
2010- }
2011- . map ( |dropper| {
2012- Ty :: async_destructor_combinator ( tcx, dropper) . instantiate ( tcx, & [ self . into ( ) ] )
2013- } )
1999+ fn surface_async_dropper_ty ( self , tcx : TyCtxt < ' tcx > ) -> Option < Ty < ' tcx > > {
2000+ let adt_def = self . ty_adt_def ( ) ?;
2001+ let dropper = adt_def
2002+ . async_destructor ( tcx)
2003+ . map ( |_| LangItem :: SurfaceAsyncDropInPlace )
2004+ . or_else ( || adt_def. destructor ( tcx) . map ( |_| LangItem :: AsyncDropSurfaceDropInPlace ) ) ?;
2005+ Some ( Ty :: async_destructor_combinator ( tcx, dropper) . instantiate ( tcx, & [ self . into ( ) ] ) )
20142006 }
20152007
20162008 fn async_destructor_combinator (
0 commit comments