Skip to content

Commit 6ed226c

Browse files
committed
rustc: Cast the LLVM representations of tag types when constructing boxes. Un-XFAIL list.rs.
1 parent 6f7e21d commit 6ed226c

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,6 @@ TEST_XFAILS_RUSTC := $(addprefix test/run-pass/, \
472472
lib-uint.rs \
473473
lib-vec-str-conversions.rs \
474474
lib-vec.rs \
475-
list.rs \
476475
many.rs \
477476
mlist-cycle.rs \
478477
mlist.rs \

src/comp/middle/trans.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2266,6 +2266,15 @@ fn trans_unary(@block_ctxt cx, ast.unop op,
22662266
vec(C_int(0),
22672267
C_int(abi.box_rc_field_body)));
22682268
sub.bcx.build.Store(C_int(1), rc);
2269+
2270+
// Cast the body type to the type of the value. This is needed to
2271+
// make tags work, since tags have a different LLVM type depending
2272+
// on whether they're boxed or not.
2273+
if (!ty.type_has_dynamic_size(e_ty)) {
2274+
auto llety = T_ptr(type_of(sub.bcx.fcx.ccx, e_ty));
2275+
body = sub.bcx.build.PointerCast(body, llety);
2276+
}
2277+
22692278
sub = copy_ty(sub.bcx, INIT, body, e_val, e_ty);
22702279
ret res(sub.bcx, box);
22712280
}

0 commit comments

Comments
 (0)