diff options
| author | Patrick Walton <[email protected]> | 2011-03-07 16:35:00 -0800 |
|---|---|---|
| committer | Patrick Walton <[email protected]> | 2011-03-07 16:35:00 -0800 |
| commit | 6ed226c6b3a28f3c10d2176d7dba7e339bf0ab99 (patch) | |
| tree | e57f199e161802f4f8aca6b6bd45e2eebe6b828e | |
| parent | rustc: Truncate or zero-extend indexes appropriately. Un-XFAIL integral-index... (diff) | |
| download | rust-6ed226c6b3a28f3c10d2176d7dba7e339bf0ab99.tar.xz rust-6ed226c6b3a28f3c10d2176d7dba7e339bf0ab99.zip | |
rustc: Cast the LLVM representations of tag types when constructing boxes. Un-XFAIL list.rs.
| -rw-r--r-- | src/Makefile | 1 | ||||
| -rw-r--r-- | src/comp/middle/trans.rs | 9 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/Makefile b/src/Makefile index 2a6e7b15..8855a2d1 100644 --- a/src/Makefile +++ b/src/Makefile @@ -472,7 +472,6 @@ TEST_XFAILS_RUSTC := $(addprefix test/run-pass/, \ lib-uint.rs \ lib-vec-str-conversions.rs \ lib-vec.rs \ - list.rs \ many.rs \ mlist-cycle.rs \ mlist.rs \ diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index 7ad96ba2..723a845d 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -2266,6 +2266,15 @@ fn trans_unary(@block_ctxt cx, ast.unop op, vec(C_int(0), C_int(abi.box_rc_field_body))); sub.bcx.build.Store(C_int(1), rc); + + // Cast the body type to the type of the value. This is needed to + // make tags work, since tags have a different LLVM type depending + // on whether they're boxed or not. + if (!ty.type_has_dynamic_size(e_ty)) { + auto llety = T_ptr(type_of(sub.bcx.fcx.ccx, e_ty)); + body = sub.bcx.build.PointerCast(body, llety); + } + sub = copy_ty(sub.bcx, INIT, body, e_val, e_ty); ret res(sub.bcx, box); } |