@@ -24,8 +24,9 @@ use crate::errors::{LongRunning, LongRunningWarn};
24
24
use crate :: fluent_generated as fluent;
25
25
use crate :: interpret:: {
26
26
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 ,
28
28
GlobalAlloc , ImmTy , InterpCx , InterpResult , MPlaceTy , OpTy , Pointer , PointerArithmetic , Scalar ,
29
+ StackPopCleanup ,
29
30
} ;
30
31
31
32
/// When hitting this many interpreted terminators we emit a deny by default lint
@@ -306,17 +307,15 @@ impl<'tcx> CompileTimeInterpCx<'tcx> {
306
307
let align = ImmTy :: from_uint ( target_align, args[ 1 ] . layout ) . into ( ) ;
307
308
let fn_abi = self . fn_abi_of_instance ( instance, ty:: List :: empty ( ) ) ?;
308
309
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,
315
315
& [ FnArg :: Copy ( addr) , FnArg :: Copy ( align) ] ,
316
316
/* with_caller_location = */ false ,
317
317
dest,
318
- ret,
319
- mir:: UnwindAction :: Unreachable ,
318
+ StackPopCleanup :: Goto { ret, unwind : mir:: UnwindAction :: Unreachable } ,
320
319
) ?;
321
320
Ok ( ControlFlow :: Break ( ( ) ) )
322
321
} else {
0 commit comments