@@ -708,7 +708,9 @@ fn iter_sequence(@block_ctxt cx,
708
708
cond_cx. build. CondBr ( end_test, body_cx. llbb, next_cx. llbb) ;
709
709
710
710
auto elt = body_cx. build. GEP ( p0, vec( ix) ) ;
711
- auto body_res = f( body_cx, elt, elt_ty) ;
711
+ auto body_res = f( body_cx,
712
+ load_non_structural( body_cx, elt, elt_ty) ,
713
+ elt_ty) ;
712
714
auto next_ix = body_res. bcx. build. Add ( ix, C_int ( 1 ) ) ;
713
715
cond_cx. build. AddIncomingToPhi ( ix, vec( next_ix) ,
714
716
vec( body_res. bcx. llbb) ) ;
@@ -751,11 +753,7 @@ fn incr_all_refcnts(@block_ctxt cx,
751
753
fn drop_slot( @block_ctxt cx,
752
754
ValueRef slot,
753
755
@typeck. ty t) -> result {
754
- if ( typeck. type_is_structural( t) ) {
755
- be drop_ty( cx, slot, t) ;
756
- } else {
757
- be drop_ty( cx, cx. build. Load ( slot) , t) ;
758
- }
756
+ be drop_ty( cx, load_non_structural( cx, slot, t) , t) ;
759
757
}
760
758
761
759
fn drop_ty( @block_ctxt cx,
@@ -955,8 +953,7 @@ fn target_type(@crate_ctxt cx, @typeck.ty t) -> @typeck.ty {
955
953
fn node_ann_type( @crate_ctxt cx, & ast. ann a) -> @typeck. ty {
956
954
alt ( a) {
957
955
case ( ast. ann_none) {
958
- log "missing type annotation" ;
959
- fail;
956
+ cx. sess. bug( "missing type annotation" ) ;
960
957
}
961
958
case ( ast. ann_type( ?t) ) {
962
959
ret target_type( cx, t) ;
@@ -1412,8 +1409,10 @@ impure fn trans_call(@block_ctxt cx, @ast.expr f,
1412
1409
1413
1410
impure fn trans_tup( @block_ctxt cx, vec[ ast. elt] elts,
1414
1411
& ast. ann ann) -> result {
1415
- auto ty = node_type( cx. fcx. ccx, ann) ;
1416
- auto tup_val = cx. build. Alloca ( ty) ;
1412
+ auto ty = node_ann_type( cx. fcx. ccx, ann) ;
1413
+ auto llty = type_of( cx. fcx. ccx, ty) ;
1414
+ auto tup_val = cx. build. Alloca ( llty) ;
1415
+ find_scope_cx( cx) . cleanups += clean( bind drop_ty( _, tup_val, ty) ) ;
1417
1416
let int i = 0 ;
1418
1417
auto r = res( cx, C_nil ( ) ) ;
1419
1418
for ( ast. elt e in elts) {
@@ -1429,8 +1428,10 @@ impure fn trans_tup(@block_ctxt cx, vec[ast.elt] elts,
1429
1428
1430
1429
impure fn trans_rec( @block_ctxt cx, vec[ ast. field] fields,
1431
1430
& ast. ann ann) -> result {
1432
- auto ty = node_type( cx. fcx. ccx, ann) ;
1433
- auto rec_val = cx. build. Alloca ( ty) ;
1431
+ auto ty = node_ann_type( cx. fcx. ccx, ann) ;
1432
+ auto llty = type_of( cx. fcx. ccx, ty) ;
1433
+ auto rec_val = cx. build. Alloca ( llty) ;
1434
+ find_scope_cx( cx) . cleanups += clean( bind drop_ty( _, rec_val, ty) ) ;
1434
1435
let int i = 0 ;
1435
1436
auto r = res( cx, C_nil ( ) ) ;
1436
1437
for ( ast. field f in fields) {
0 commit comments