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/comp | |
| 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/comp')
| -rw-r--r-- | src/comp/middle/trans.rs | 23 |
1 files changed, 18 insertions, 5 deletions
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; } |