@@ -363,17 +363,22 @@ fn T_taskptr(type_names tn) -> TypeRef {
363
363
ret T_ptr ( T_task ( tn) ) ;
364
364
}
365
365
366
- fn T_typaram_ptr ( type_names tn) -> TypeRef {
366
+ // This type must never be used directly; it must always be cast away.
367
+ fn T_typaram ( type_names tn) -> TypeRef {
367
368
auto s = "typaram" ;
368
369
if ( tn. name_has_type ( s) ) {
369
370
ret tn. get_type ( s) ;
370
371
}
371
372
372
- auto t = T_ptr ( T_i8 ( ) ) ;
373
+ auto t = T_i8 ( ) ;
373
374
tn. associate ( s, t) ;
374
375
ret t;
375
376
}
376
377
378
+ fn T_typaram_ptr ( type_names tn) -> TypeRef {
379
+ ret T_ptr ( T_typaram ( tn) ) ;
380
+ }
381
+
377
382
fn T_closure_ptr ( type_names tn,
378
383
TypeRef lltarget_ty ,
379
384
TypeRef llbindings_ty ,
@@ -2068,7 +2073,6 @@ fn call_tydesc_glue(@block_ctxt cx, ValueRef v, @ty.t t, int field) {
2068
2073
fn incr_all_refcnts( @block_ctxt cx,
2069
2074
ValueRef v,
2070
2075
@ty. t t) -> result {
2071
-
2072
2076
if ( !ty. type_is_scalar( t) ) {
2073
2077
call_tydesc_glue( cx, v, t, abi. tydesc_field_take_glue_off) ;
2074
2078
}
@@ -4820,9 +4824,18 @@ fn trans_tag_variant(@crate_ctxt cx, ast.def_id tag_id,
4820
4824
// works. So we have to cast to the destination's view of the type.
4821
4825
auto llargptr = bcx. build. PointerCast ( fcx. llargs. get( va. id) ,
4822
4826
val_ty( lldestptr) ) ;
4823
- auto llargval = bcx. build. Load ( llargptr) ;
4824
4827
4825
- bcx. build. Store ( llargval, lldestptr) ;
4828
+ auto arg_ty = arg_tys. ( i) . ty;
4829
+ auto llargval;
4830
+ if ( ty. type_is_structural( arg_ty) ) {
4831
+ llargval = llargptr;
4832
+ } else {
4833
+ llargval = bcx. build. Load ( llargptr) ;
4834
+ }
4835
+
4836
+ rslt = copy_ty( bcx, INIT , lldestptr, llargval, arg_ty) ;
4837
+ bcx = rslt. bcx;
4838
+
4826
4839
i += 1 u;
4827
4840
}
4828
4841
0 commit comments