@@ -24,8 +24,9 @@ use crate::errors::{LongRunning, LongRunningWarn};
2424use crate :: fluent_generated as fluent;
2525use crate :: interpret:: {
2626 self , compile_time_machine, err_ub, throw_exhaust, throw_inval, throw_ub_custom, throw_unsup,
27- throw_unsup_format, AllocId , AllocRange , ConstAllocation , CtfeProvenance , FnArg , FnVal , Frame ,
27+ throw_unsup_format, AllocId , AllocRange , ConstAllocation , CtfeProvenance , FnArg , Frame ,
2828 GlobalAlloc , ImmTy , InterpCx , InterpResult , MPlaceTy , OpTy , Pointer , PointerArithmetic , Scalar ,
29+ StackPopCleanup ,
2930} ;
3031
3132/// When hitting this many interpreted terminators we emit a deny by default lint
@@ -306,17 +307,15 @@ impl<'tcx> CompileTimeInterpCx<'tcx> {
306307 let align = ImmTy :: from_uint ( target_align, args[ 1 ] . layout ) . into ( ) ;
307308 let fn_abi = self . fn_abi_of_instance ( instance, ty:: List :: empty ( ) ) ?;
308309
309- // We replace the entire function call with a "tail call".
310- // Note that this happens before the frame of the original function
311- // is pushed on the stack.
312- self . eval_fn_call (
313- FnVal :: Instance ( instance) ,
314- ( CallAbi :: Rust , fn_abi) ,
310+ // Push the stack frame with our own adjusted arguments.
311+ self . init_stack_frame (
312+ instance,
313+ self . load_mir ( instance. def , None ) ?,
314+ fn_abi,
315315 & [ FnArg :: Copy ( addr) , FnArg :: Copy ( align) ] ,
316316 /* with_caller_location = */ false ,
317317 dest,
318- ret,
319- mir:: UnwindAction :: Unreachable ,
318+ StackPopCleanup :: Goto { ret, unwind : mir:: UnwindAction :: Unreachable } ,
320319 ) ?;
321320 Ok ( ControlFlow :: Break ( ( ) ) )
322321 } else {
0 commit comments