@@ -22,7 +22,7 @@ use rustc_target::spec::abi::Abi as CallAbi;
2222
2323use crate :: errors:: { LongRunning , LongRunningWarn } ;
2424use crate :: interpret:: {
25- self , compile_time_machine, AllocId , ConstAllocation , FnVal , Frame , ImmTy , InterpCx ,
25+ self , compile_time_machine, AllocId , ConstAllocation , FnArg , FnVal , Frame , ImmTy , InterpCx ,
2626 InterpResult , OpTy , PlaceTy , Pointer , Scalar ,
2727} ;
2828use crate :: { errors, fluent_generated as fluent} ;
@@ -201,7 +201,7 @@ impl<'mir, 'tcx: 'mir> CompileTimeEvalContext<'mir, 'tcx> {
201201 fn hook_special_const_fn (
202202 & mut self ,
203203 instance : ty:: Instance < ' tcx > ,
204- args : & [ OpTy < ' tcx > ] ,
204+ args : & [ FnArg < ' tcx > ] ,
205205 dest : & PlaceTy < ' tcx > ,
206206 ret : Option < mir:: BasicBlock > ,
207207 ) -> InterpResult < ' tcx , Option < ty:: Instance < ' tcx > > > {
@@ -210,6 +210,7 @@ impl<'mir, 'tcx: 'mir> CompileTimeEvalContext<'mir, 'tcx> {
210210 if Some ( def_id) == self . tcx . lang_items ( ) . panic_display ( )
211211 || Some ( def_id) == self . tcx . lang_items ( ) . begin_panic_fn ( )
212212 {
213+ let args = self . copy_fn_args ( args) ?;
213214 // &str or &&str
214215 assert ! ( args. len( ) == 1 ) ;
215216
@@ -236,8 +237,9 @@ impl<'mir, 'tcx: 'mir> CompileTimeEvalContext<'mir, 'tcx> {
236237
237238 return Ok ( Some ( new_instance) ) ;
238239 } else if Some ( def_id) == self . tcx . lang_items ( ) . align_offset_fn ( ) {
240+ let args = self . copy_fn_args ( args) ?;
239241 // For align_offset, we replace the function call if the pointer has no address.
240- match self . align_offset ( instance, args, dest, ret) ? {
242+ match self . align_offset ( instance, & args, dest, ret) ? {
241243 ControlFlow :: Continue ( ( ) ) => return Ok ( Some ( instance) ) ,
242244 ControlFlow :: Break ( ( ) ) => return Ok ( None ) ,
243245 }
@@ -293,7 +295,7 @@ impl<'mir, 'tcx: 'mir> CompileTimeEvalContext<'mir, 'tcx> {
293295 self . eval_fn_call (
294296 FnVal :: Instance ( instance) ,
295297 ( CallAbi :: Rust , fn_abi) ,
296- & [ addr, align] ,
298+ & [ FnArg :: Copy ( addr) , FnArg :: Copy ( align) ] ,
297299 /* with_caller_location = */ false ,
298300 dest,
299301 ret,
@@ -427,7 +429,7 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
427429 ecx : & mut InterpCx < ' mir , ' tcx , Self > ,
428430 instance : ty:: Instance < ' tcx > ,
429431 _abi : CallAbi ,
430- args : & [ OpTy < ' tcx > ] ,
432+ args : & [ FnArg < ' tcx > ] ,
431433 dest : & PlaceTy < ' tcx > ,
432434 ret : Option < mir:: BasicBlock > ,
433435 _unwind : mir:: UnwindAction , // unwinding is not supported in consts
0 commit comments