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