@@ -7,7 +7,7 @@ use std::borrow::Cow;
77use either:: { Left , Right } ;
88use rustc_abi:: { self as abi, ExternAbi , FieldIdx , Integer , VariantIdx } ;
99use rustc_hir:: def_id:: DefId ;
10- use rustc_hir:: { LangItem , find_attr} ;
10+ use rustc_hir:: find_attr;
1111use rustc_middle:: ty:: layout:: { IntegerExt , TyAndLayout } ;
1212use rustc_middle:: ty:: { self , AdtDef , Instance , Ty , Unnormalized , VariantDef } ;
1313use rustc_middle:: { bug, mir, span_bug} ;
@@ -278,7 +278,6 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
278278 callee_arg : & mir:: Place < ' tcx > ,
279279 callee_ty : Ty < ' tcx > ,
280280 already_live : bool ,
281- is_drop_in_place : bool ,
282281 ) -> InterpResult < ' tcx >
283282 where
284283 ' tcx : ' x ,
@@ -323,16 +322,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
323322 self . storage_live_dyn ( local, meta) ?;
324323 }
325324 // Now we can finally actually evaluate the callee place.
326- let mut callee_arg = self . eval_place ( * callee_arg) ?;
327- // drop_in_place has a signature which says that the first argument is `*mut T`
328- // but really it's `&mut T`. This is where we handle that terrible hack in
329- // the MIR semantics.
330- // FIXME(#154274): remove this hack.
331- if is_drop_in_place && callee_arg_idx == 0 {
332- let pointee_ty = callee_arg. layout . ty . builtin_deref ( true ) . unwrap ( ) ;
333- let mutref_ty = Ty :: new_mut_ref ( * self . tcx , self . tcx . lifetimes . re_erased , pointee_ty) ;
334- callee_arg = callee_arg. transmute ( self . layout_of ( mutref_ty) ?, self ) ?;
335- }
325+ let callee_arg = self . eval_place ( * callee_arg) ?;
336326 // We allow some transmutes here.
337327 // FIXME: Depending on the PassMode, this should reset some padding to uninitialized. (This
338328 // is true for all `copy_op`, but there are a lot of special cases for argument passing
@@ -464,12 +454,6 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
464454 // Determine whether there is a special VaList argument. This is always the
465455 // last argument, and since arguments start at index 1 that's `arg_count`.
466456 let va_list_arg = callee_fn_abi. c_variadic . then ( || mir:: Local :: from_usize ( body. arg_count ) ) ;
467- // Part of the hack for #154274, see `pass_argument`.
468- let is_drop_in_place = {
469- let def_id = body. source . def_id ( ) ;
470- self . tcx . is_lang_item ( def_id, LangItem :: DropInPlace )
471- || self . tcx . is_lang_item ( def_id, LangItem :: AsyncDropInPlace )
472- } ;
473457
474458 // During argument passing, we want retagging with protectors.
475459 M :: with_retag_mode ( self , RetagMode :: FnEntry , |ecx| {
@@ -532,7 +516,6 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
532516 & dest,
533517 field_ty,
534518 /* already_live */ true ,
535- is_drop_in_place,
536519 ) ?;
537520 }
538521 } else {
@@ -545,7 +528,6 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
545528 & dest,
546529 ty,
547530 /* already_live */ false ,
548- is_drop_in_place,
549531 ) ?;
550532 }
551533 }
@@ -913,19 +895,21 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
913895 _ => {
914896 debug_assert_eq ! (
915897 instance,
916- ty:: Instance :: resolve_drop_in_place ( * self . tcx, place. layout. ty)
898+ ty:: Instance :: resolve_drop_glue ( * self . tcx, place. layout. ty)
917899 ) ;
918900 place
919901 }
920902 } ;
903+
921904 let instance = {
922- let _trace =
923- enter_trace_span ! ( M , resolve:: resolve_drop_in_place, ty = ?place. layout. ty) ;
924- ty:: Instance :: resolve_drop_in_place ( * self . tcx , place. layout . ty )
905+ let _trace = enter_trace_span ! ( M , resolve:: resolve_drop_glue, ty = ?place. layout. ty) ;
906+ ty:: Instance :: resolve_drop_glue ( * self . tcx , place. layout . ty )
925907 } ;
926908 let fn_abi = self . fn_abi_of_instance_no_deduced_attrs ( instance, ty:: List :: empty ( ) ) ?;
927909
928- let arg = self . mplace_to_imm_ptr ( & place, None ) ?;
910+ let ref_ty = Ty :: new_mut_ref ( self . tcx . tcx , self . tcx . lifetimes . re_erased , place. layout . ty ) ;
911+ let arg = self . mplace_to_imm_ptr ( & place, Some ( ref_ty) ) ?;
912+
929913 let ret = MPlaceTy :: fake_alloc_zst ( self . layout_of ( self . tcx . types . unit ) ?) ;
930914
931915 self . init_fn_call (
0 commit comments