@@ -1945,8 +1945,23 @@ pub fn trans_tuple_struct(ccx: @CrateContext,
1945
1945
let arg_tys = ty::ty_fn_args(node_id_type(bcx, ctor_id));
1946
1946
let bcx = copy_args_to_allocas(fcx, bcx, fn_args, raw_llargs, arg_tys);
1947
1947
1948
+ // XXX is there a better way to reconstruct the ty::t?
1949
+ let ty_param_substs = match param_substs {
1950
+ Some(ref substs) => /*bad*/copy substs.tys,
1951
+ None => ~[]
1952
+ };
1953
+ let ctor_ty = ty::subst_tps(ccx.tcx, ty_param_substs, None,
1954
+ ty::node_id_to_type(ccx.tcx, ctor_id));
1955
+ let tup_ty = match ty::get(ctor_ty).sty {
1956
+ ty::ty_bare_fn(ref bft) => bft.sig.output,
1957
+ _ => ccx.sess.bug(fmt!(" trans_tuple_struct: unexpected ctor \
1958
+ return type %s",
1959
+ ty_to_str(ccx.tcx, ctor_ty)))
1960
+ };
1961
+ let repr = adt::represent_type(ccx, tup_ty);
1962
+
1948
1963
for fields.eachi |i, field| {
1949
- let lldestptr = GEPi (bcx, fcx.llretptr, [ 0, 0, i] );
1964
+ let lldestptr = adt::trans_GEP (bcx, &repr, fcx.llretptr, 0, i );
1950
1965
let llarg = match fcx.llargs.get(&field.node.id) {
1951
1966
local_mem(x) => x,
1952
1967
_ => {
0 commit comments