diff options
| author | Patrick Walton <[email protected]> | 2011-03-07 18:03:33 -0800 |
|---|---|---|
| committer | Patrick Walton <[email protected]> | 2011-03-07 18:03:33 -0800 |
| commit | 3473ff3bff2ed2286080812417068552d6b9df31 (patch) | |
| tree | ab6474b6c89c6ef6de2cecf43c21f9f91e8dffc1 /src | |
| parent | rustc: Cast the LLVM representations of tag types when constructing boxes. Un... (diff) | |
| download | rust-3473ff3bff2ed2286080812417068552d6b9df31.tar.xz rust-3473ff3bff2ed2286080812417068552d6b9df31.zip | |
rustc: Cast dynamically-sized tags in iter_structural_ty_full() to opaque tag types. Un-XFAIL generic-recursive-tag.rs.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Makefile | 1 | ||||
| -rw-r--r-- | src/comp/middle/trans.rs | 20 |
2 files changed, 16 insertions, 5 deletions
diff --git a/src/Makefile b/src/Makefile index 8855a2d1..a239329f 100644 --- a/src/Makefile +++ b/src/Makefile @@ -453,7 +453,6 @@ TEST_XFAILS_RUSTC := $(addprefix test/run-pass/, \ foreach-simple-outer-slot.rs \ generic-fn-twice.rs \ generic-iter-frame.rs \ - generic-recursive-tag.rs \ generic-tag-alt.rs \ generic-tag-values.rs \ iter-range.rs \ diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index 723a845d..a282c0a2 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -1053,6 +1053,9 @@ fn dynamic_align_of(@block_ctxt cx, @ty.t t) -> result { } ret res(bcx, a); } + case (ty.ty_tag(_, _)) { + ret res(cx, C_int(1)); // FIXME: stub + } } } @@ -1805,12 +1808,21 @@ fn iter_structural_ty_full(@block_ctxt cx, auto variants = tag_variants(cx.fcx.ccx, tid); auto n_variants = _vec.len[ast.variant](variants); - auto lldiscrim_a_ptr = cx.build.GEP(av, vec(C_int(0), C_int(0))); - auto llunion_a_ptr = cx.build.GEP(av, vec(C_int(0), C_int(1))); + // Cast the tags to types we can GEP into. + auto lltagty = T_opaque_tag_ptr(cx.fcx.ccx.tn); + auto av_tag = cx.build.PointerCast(av, lltagty); + auto bv_tag = cx.build.PointerCast(bv, lltagty); + + auto lldiscrim_a_ptr = cx.build.GEP(av_tag, + vec(C_int(0), C_int(0))); + auto llunion_a_ptr = cx.build.GEP(av_tag, + vec(C_int(0), C_int(1))); auto lldiscrim_a = cx.build.Load(lldiscrim_a_ptr); - auto lldiscrim_b_ptr = cx.build.GEP(bv, vec(C_int(0), C_int(0))); - auto llunion_b_ptr = cx.build.GEP(bv, vec(C_int(0), C_int(1))); + auto lldiscrim_b_ptr = cx.build.GEP(bv_tag, + vec(C_int(0), C_int(0))); + auto llunion_b_ptr = cx.build.GEP(bv_tag, + vec(C_int(0), C_int(1))); auto lldiscrim_b = cx.build.Load(lldiscrim_b_ptr); // NB: we must hit the discriminant first so that structural |