@@ -270,6 +270,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
270270 Item = ( & ' x FnArg < ' tcx , M :: Provenance > , & ' y ArgAbi < ' tcx , Ty < ' tcx > > ) ,
271271 > ,
272272 callee_abi : & ArgAbi < ' tcx , Ty < ' tcx > > ,
273+ callee_arg_idx : usize ,
273274 callee_arg : & mir:: Place < ' tcx > ,
274275 callee_ty : Ty < ' tcx > ,
275276 already_live : bool ,
@@ -298,6 +299,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
298299 // Check compatibility
299300 if !self . check_argument_compat ( caller_abi, callee_abi) ? {
300301 throw_ub ! ( AbiMismatchArgument {
302+ arg_idx: callee_arg_idx,
301303 caller_ty: caller_abi. layout. ty,
302304 callee_ty: callee_abi. layout. ty
303305 } ) ;
@@ -424,7 +426,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
424426 // this is a single iterator (that handles `spread_arg`), then
425427 // `pass_argument` would be the loop body. It takes care to
426428 // 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 ( ) ;
428430 for local in body. args_iter ( ) {
429431 // Construct the destination place for this argument. At this point all
430432 // locals are still dead, so we cannot construct a `PlaceTy`.
@@ -445,21 +447,23 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
445447 & [ mir:: ProjectionElem :: Field ( FieldIdx :: from_usize ( i) , field_ty) ] ,
446448 * self . tcx ,
447449 ) ;
448- let callee_abi = callee_args_abis. next ( ) . unwrap ( ) ;
450+ let ( idx , callee_abi) = callee_args_abis. next ( ) . unwrap ( ) ;
449451 self . pass_argument (
450452 & mut caller_args,
451453 callee_abi,
454+ idx,
452455 & dest,
453456 field_ty,
454457 /* already_live */ true ,
455458 ) ?;
456459 }
457460 } else {
458461 // 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 ( ) ;
460463 self . pass_argument (
461464 & mut caller_args,
462465 callee_abi,
466+ idx,
463467 & dest,
464468 ty,
465469 /* already_live */ false ,
0 commit comments