- let lltuplety = type_of::type_of(bcx.ccx(), arg_ty);
- let lltemp = bcx.with_block(|bcx| {
- base::alloc_ty(bcx, arg_ty, &format!("arg{}", arg_index))
- });
- for (i, &tupled_arg_ty) in tupled_arg_tys.iter().enumerate() {
- let dst = bcx.struct_gep(lltemp, i);
- let arg = &fcx.fn_ty.args[idx];
- idx += 1;
- if common::type_is_fat_ptr(tcx, tupled_arg_ty) {
- // We pass fat pointers as two words, but inside the tuple
- // they are the two sub-fields of a single aggregate field.
- let meta = &fcx.fn_ty.args[idx];
+ if let Some(spread_local) = mir.spread_arg {
+ if local == spread_local {
+ // This argument (e.g. the last argument in the "rust-call" ABI)
+ // is a tuple that was spread at the ABI level and now we have
+ // to reconstruct it into a tuple local variable, from multiple
+ // individual LLVM function arguments.
+
+ let tupled_arg_tys = match arg_ty.sty {
+ ty::TyTuple(ref tys) => tys,
+ _ => bug!("spread argument isn't a tuple?!")
+ };
+
+ let lltuplety = type_of::type_of(bcx.ccx(), arg_ty);
+ let lltemp = bcx.with_block(|bcx| {
+ base::alloc_ty(bcx, arg_ty, &format!("arg{}", arg_index))
+ });
+ for (i, &tupled_arg_ty) in tupled_arg_tys.iter().enumerate() {
+ let dst = bcx.struct_gep(lltemp, i);
+ let arg = &fcx.fn_ty.args[idx];