@@ -270,6 +270,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
270
270
Item = ( & ' x FnArg < ' tcx , M :: Provenance > , & ' y ArgAbi < ' tcx , Ty < ' tcx > > ) ,
271
271
> ,
272
272
callee_abi : & ArgAbi < ' tcx , Ty < ' tcx > > ,
273
+ callee_arg_idx : usize ,
273
274
callee_arg : & mir:: Place < ' tcx > ,
274
275
callee_ty : Ty < ' tcx > ,
275
276
already_live : bool ,
@@ -298,6 +299,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
298
299
// Check compatibility
299
300
if !self . check_argument_compat ( caller_abi, callee_abi) ? {
300
301
throw_ub ! ( AbiMismatchArgument {
302
+ arg_idx: callee_arg_idx,
301
303
caller_ty: caller_abi. layout. ty,
302
304
callee_ty: callee_abi. layout. ty
303
305
} ) ;
@@ -424,7 +426,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
424
426
// this is a single iterator (that handles `spread_arg`), then
425
427
// `pass_argument` would be the loop body. It takes care to
426
428
// not advance `caller_iter` for ignored arguments.
427
- let mut callee_args_abis = callee_fn_abi. args . iter ( ) ;
429
+ let mut callee_args_abis = callee_fn_abi. args . iter ( ) . enumerate ( ) ;
428
430
for local in body. args_iter ( ) {
429
431
// Construct the destination place for this argument. At this point all
430
432
// locals are still dead, so we cannot construct a `PlaceTy`.
@@ -445,21 +447,23 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
445
447
& [ mir:: ProjectionElem :: Field ( FieldIdx :: from_usize ( i) , field_ty) ] ,
446
448
* self . tcx ,
447
449
) ;
448
- let callee_abi = callee_args_abis. next ( ) . unwrap ( ) ;
450
+ let ( idx , callee_abi) = callee_args_abis. next ( ) . unwrap ( ) ;
449
451
self . pass_argument (
450
452
& mut caller_args,
451
453
callee_abi,
454
+ idx,
452
455
& dest,
453
456
field_ty,
454
457
/* already_live */ true ,
455
458
) ?;
456
459
}
457
460
} else {
458
461
// Normal argument. Cannot mark it as live yet, it might be unsized!
459
- let callee_abi = callee_args_abis. next ( ) . unwrap ( ) ;
462
+ let ( idx , callee_abi) = callee_args_abis. next ( ) . unwrap ( ) ;
460
463
self . pass_argument (
461
464
& mut caller_args,
462
465
callee_abi,
466
+ idx,
463
467
& dest,
464
468
ty,
465
469
/* already_live */ false ,
0 commit comments