@@ -1935,7 +1935,7 @@ impl<'tcx> Ty<'tcx> {
1935
1935
ty:: Adt ( adt_def, _) => {
1936
1936
assert ! ( adt_def. is_union( ) ) ;
1937
1937
1938
- let surface_drop = self . surface_async_dropper_ty ( tcx, param_env ) . unwrap ( ) ;
1938
+ let surface_drop = self . surface_async_dropper_ty ( tcx) . unwrap ( ) ;
1939
1939
1940
1940
Ty :: async_destructor_combinator ( tcx, LangItem :: AsyncDropFuse )
1941
1941
. instantiate ( tcx, & [ surface_drop. into ( ) ] )
@@ -1985,7 +1985,7 @@ impl<'tcx> Ty<'tcx> {
1985
1985
} )
1986
1986
. unwrap ( ) ;
1987
1987
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) {
1989
1989
Ty :: async_destructor_combinator ( tcx, LangItem :: AsyncDropChain )
1990
1990
. instantiate ( tcx, & [ dropper_ty. into ( ) , variants_dtor. into ( ) ] )
1991
1991
} else {
@@ -1996,21 +1996,13 @@ impl<'tcx> Ty<'tcx> {
1996
1996
. instantiate ( tcx, & [ dtor. into ( ) ] )
1997
1997
}
1998
1998
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 ( ) ] ) )
2014
2006
}
2015
2007
2016
2008
fn async_destructor_combinator (
0 commit comments