@@ -22,7 +22,7 @@ use rustc_target::spec::abi::Abi as CallAbi;
22
22
23
23
use crate :: errors:: { LongRunning , LongRunningWarn } ;
24
24
use 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 ,
26
26
InterpResult , OpTy , PlaceTy , Pointer , Scalar ,
27
27
} ;
28
28
use crate :: { errors, fluent_generated as fluent} ;
@@ -201,7 +201,7 @@ impl<'mir, 'tcx: 'mir> CompileTimeEvalContext<'mir, 'tcx> {
201
201
fn hook_special_const_fn (
202
202
& mut self ,
203
203
instance : ty:: Instance < ' tcx > ,
204
- args : & [ OpTy < ' tcx > ] ,
204
+ args : & [ FnArg < ' tcx > ] ,
205
205
dest : & PlaceTy < ' tcx > ,
206
206
ret : Option < mir:: BasicBlock > ,
207
207
) -> InterpResult < ' tcx , Option < ty:: Instance < ' tcx > > > {
@@ -210,6 +210,7 @@ impl<'mir, 'tcx: 'mir> CompileTimeEvalContext<'mir, 'tcx> {
210
210
if Some ( def_id) == self . tcx . lang_items ( ) . panic_display ( )
211
211
|| Some ( def_id) == self . tcx . lang_items ( ) . begin_panic_fn ( )
212
212
{
213
+ let args = self . copy_fn_args ( args) ?;
213
214
// &str or &&str
214
215
assert ! ( args. len( ) == 1 ) ;
215
216
@@ -236,8 +237,9 @@ impl<'mir, 'tcx: 'mir> CompileTimeEvalContext<'mir, 'tcx> {
236
237
237
238
return Ok ( Some ( new_instance) ) ;
238
239
} else if Some ( def_id) == self . tcx . lang_items ( ) . align_offset_fn ( ) {
240
+ let args = self . copy_fn_args ( args) ?;
239
241
// 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) ? {
241
243
ControlFlow :: Continue ( ( ) ) => return Ok ( Some ( instance) ) ,
242
244
ControlFlow :: Break ( ( ) ) => return Ok ( None ) ,
243
245
}
@@ -293,7 +295,7 @@ impl<'mir, 'tcx: 'mir> CompileTimeEvalContext<'mir, 'tcx> {
293
295
self . eval_fn_call (
294
296
FnVal :: Instance ( instance) ,
295
297
( CallAbi :: Rust , fn_abi) ,
296
- & [ addr, align] ,
298
+ & [ FnArg :: Copy ( addr) , FnArg :: Copy ( align) ] ,
297
299
/* with_caller_location = */ false ,
298
300
dest,
299
301
ret,
@@ -427,7 +429,7 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
427
429
ecx : & mut InterpCx < ' mir , ' tcx , Self > ,
428
430
instance : ty:: Instance < ' tcx > ,
429
431
_abi : CallAbi ,
430
- args : & [ OpTy < ' tcx > ] ,
432
+ args : & [ FnArg < ' tcx > ] ,
431
433
dest : & PlaceTy < ' tcx > ,
432
434
ret : Option < mir:: BasicBlock > ,
433
435
_unwind : mir:: UnwindAction , // unwinding is not supported in consts
0 commit comments