Skip to content

Commit 708c385

Browse files
committed
Use trans_arg_datum in trans_args_under_call_abi
The logic for the argument translation was duplicated here.
1 parent 41f8b1e commit 708c385

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/librustc_trans/trans/callee.rs

+11-10
Original file line numberDiff line numberDiff line change
@@ -927,20 +927,21 @@ fn trans_args_under_call_abi<'blk, 'tcx>(
927927
tuple_expr.id));
928928
let repr = adt::represent_type(bcx.ccx(), tuple_type);
929929
let repr_ptr = &*repr;
930-
for i in 0..field_types.len() {
930+
llargs.extend(field_types.iter().enumerate().map(|(i, field_type)| {
931931
let arg_datum = tuple_lvalue_datum.get_element(
932932
bcx,
933-
field_types[i],
933+
field_type,
934934
|srcval| {
935935
adt::trans_field_ptr(bcx, repr_ptr, srcval, 0, i)
936-
});
937-
let arg_datum = arg_datum.to_expr_datum();
938-
let arg_datum =
939-
unpack_datum!(bcx, arg_datum.to_rvalue_datum(bcx, "arg"));
940-
let arg_datum =
941-
unpack_datum!(bcx, arg_datum.to_appropriate_datum(bcx));
942-
llargs.push(arg_datum.add_clean(bcx.fcx, arg_cleanup_scope));
943-
}
936+
}).to_expr_datum();
937+
unpack_result!(bcx, trans_arg_datum(
938+
bcx,
939+
field_type,
940+
arg_datum,
941+
arg_cleanup_scope,
942+
DontAutorefArg)
943+
)
944+
}));
944945
}
945946
_ => {
946947
bcx.sess().span_bug(tuple_expr.span,

0 commit comments

Comments
 (0)