diff options
| author | Patrick Walton <[email protected]> | 2011-03-04 18:05:48 -0800 |
|---|---|---|
| committer | Patrick Walton <[email protected]> | 2011-03-04 18:05:48 -0800 |
| commit | 94b681afe4f8fb09141d459963b268c76fbd0072 (patch) | |
| tree | decda8d0620f3fb17b9790363ce66f31e0512ae0 /src | |
| parent | rustc: Don't recurse forever if type glue needs to refer to its own type desc... (diff) | |
| download | rust-94b681afe4f8fb09141d459963b268c76fbd0072.tar.xz rust-94b681afe4f8fb09141d459963b268c76fbd0072.zip | |
rustc: Use copy_ty() when initializing N-ary tag variants. Un-XFAIL generic-tag.rs.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Makefile | 3 | ||||
| -rw-r--r-- | src/comp/middle/trans.rs | 23 |
2 files changed, 19 insertions, 7 deletions
diff --git a/src/Makefile b/src/Makefile index 2ec0f9d1..484740b5 100644 --- a/src/Makefile +++ b/src/Makefile @@ -432,8 +432,7 @@ TEST_XFAILS_BOOT := $(TASK_XFAILS) \ test/compile-fail/tail-non-call.rs \ test/compile-fail/writing-through-read-alias.rs -TEST_XFAILS_RUSTC := $(CONST_TAG_XFAILS) \ - $(addprefix test/run-pass/, \ +TEST_XFAILS_RUSTC := $(addprefix test/run-pass/, \ acyclic-unwind.rs \ alt-pattern-drop.rs \ alt-type-simple.rs \ diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index 9b7a501c..b5ff4224 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -363,17 +363,22 @@ fn T_taskptr(type_names tn) -> TypeRef { ret T_ptr(T_task(tn)); } -fn T_typaram_ptr(type_names tn) -> TypeRef { +// This type must never be used directly; it must always be cast away. +fn T_typaram(type_names tn) -> TypeRef { auto s = "typaram"; if (tn.name_has_type(s)) { ret tn.get_type(s); } - auto t = T_ptr(T_i8()); + auto t = T_i8(); tn.associate(s, t); ret t; } +fn T_typaram_ptr(type_names tn) -> TypeRef { + ret T_ptr(T_typaram(tn)); +} + fn T_closure_ptr(type_names tn, TypeRef lltarget_ty, TypeRef llbindings_ty, @@ -2068,7 +2073,6 @@ fn call_tydesc_glue(@block_ctxt cx, ValueRef v, @ty.t t, int field) { fn incr_all_refcnts(@block_ctxt cx, ValueRef v, @ty.t t) -> result { - if (!ty.type_is_scalar(t)) { call_tydesc_glue(cx, v, t, abi.tydesc_field_take_glue_off); } @@ -4820,9 +4824,18 @@ fn trans_tag_variant(@crate_ctxt cx, ast.def_id tag_id, // works. So we have to cast to the destination's view of the type. auto llargptr = bcx.build.PointerCast(fcx.llargs.get(va.id), val_ty(lldestptr)); - auto llargval = bcx.build.Load(llargptr); - bcx.build.Store(llargval, lldestptr); + auto arg_ty = arg_tys.(i).ty; + auto llargval; + if (ty.type_is_structural(arg_ty)) { + llargval = llargptr; + } else { + llargval = bcx.build.Load(llargptr); + } + + rslt = copy_ty(bcx, INIT, lldestptr, llargval, arg_ty); + bcx = rslt.bcx; + i += 1u; } |