@@ -1991,7 +1991,7 @@ impl<'tcx> Ty<'tcx> {
1991
1991
ty:: Adt ( adt_def, _) => {
1992
1992
assert ! ( adt_def. is_union( ) ) ;
1993
1993
1994
- let surface_drop = self . surface_async_dropper_ty ( tcx, param_env ) . unwrap ( ) ;
1994
+ let surface_drop = self . surface_async_dropper_ty ( tcx) . unwrap ( ) ;
1995
1995
1996
1996
Ty :: async_destructor_combinator ( tcx, LangItem :: AsyncDropFuse )
1997
1997
. instantiate ( tcx, & [ surface_drop. into ( ) ] )
@@ -2041,7 +2041,7 @@ impl<'tcx> Ty<'tcx> {
2041
2041
} )
2042
2042
. unwrap ( ) ;
2043
2043
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) {
2045
2045
Ty :: async_destructor_combinator ( tcx, LangItem :: AsyncDropChain )
2046
2046
. instantiate ( tcx, & [ dropper_ty. into ( ) , variants_dtor. into ( ) ] )
2047
2047
} else {
@@ -2052,21 +2052,13 @@ impl<'tcx> Ty<'tcx> {
2052
2052
. instantiate ( tcx, & [ dtor. into ( ) ] )
2053
2053
}
2054
2054
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 ( ) ] ) )
2070
2062
}
2071
2063
2072
2064
fn async_destructor_combinator (
0 commit comments