Skip to content

Commit d607316

Browse files
committed
rustc: Pass actual tydescs to upcall_malloc
1 parent 7814745 commit d607316

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/comp/middle/trans.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -837,13 +837,17 @@ fn trans_malloc_boxed_raw(cx: @block_ctxt, t: ty::t) -> result {
837837
// wants.
838838
// FIXME: Could avoid this check with a postcondition on mk_imm_box?
839839
// (requires Issue #586)
840-
let ccx = bcx_ccx(cx);
841-
let sp = cx.sp;
840+
let ccx = bcx_ccx(bcx);
841+
let sp = bcx.sp;
842842
check (type_has_static_size(ccx, box_ptr));
843843
let llty = type_of(ccx, sp, box_ptr);
844844

845-
let tydesc = C_null(T_ptr(ccx.tydesc_type));
846-
let rval = Call(cx, ccx.upcalls.malloc, [cx.fcx.lltaskptr, llsz, tydesc]);
845+
let ti = none;
846+
let tydesc_result = get_tydesc(bcx, t, true, tps_normal, ti);
847+
let lltydesc = tydesc_result.result.val; bcx = tydesc_result.result.bcx;
848+
849+
let rval = Call(cx, ccx.upcalls.malloc,
850+
[cx.fcx.lltaskptr, llsz, lltydesc]);
847851
ret rslt(cx, PointerCast(cx, rval, llty));
848852
}
849853

0 commit comments

Comments
 (0)