@@ -876,8 +876,8 @@ fn trans_def_dps_unadjusted<'a>(
876
876
// Nullary variant.
877
877
let ty = expr_ty ( bcx, ref_expr) ;
878
878
let repr = adt:: represent_type ( bcx. ccx ( ) , ty) ;
879
- adt:: trans_start_init ( bcx, & * repr, lldest,
880
- variant_info. disr_val ) ;
879
+ adt:: trans_set_discr ( bcx, & * repr, lldest,
880
+ variant_info. disr_val ) ;
881
881
return bcx;
882
882
}
883
883
}
@@ -886,7 +886,7 @@ fn trans_def_dps_unadjusted<'a>(
886
886
match ty:: get ( ty) . sty {
887
887
ty:: ty_struct( did, _) if ty:: has_dtor ( bcx. tcx ( ) , did) => {
888
888
let repr = adt:: represent_type ( bcx. ccx ( ) , ty) ;
889
- adt:: trans_start_init ( bcx, & * repr, lldest, 0 ) ;
889
+ adt:: trans_set_discr ( bcx, & * repr, lldest, 0 ) ;
890
890
}
891
891
_ => { }
892
892
}
@@ -1098,7 +1098,7 @@ fn trans_rec_or_struct<'a>(
1098
1098
* Note that `fields` may be empty; the base expression must always be
1099
1099
* evaluated for side-effects.
1100
1100
*/
1101
- struct StructBaseInfo {
1101
+ pub struct StructBaseInfo {
1102
1102
/// The base expression; will be evaluated after all explicit fields.
1103
1103
expr : Gc < ast:: Expr > ,
1104
1104
/// The indices of fields to copy paired with their types.
@@ -1114,14 +1114,12 @@ struct StructBaseInfo {
1114
1114
* - `optbase` contains information on the base struct (if any) from
1115
1115
* which remaining fields are copied; see comments on `StructBaseInfo`.
1116
1116
*/
1117
- fn trans_adt < ' a > (
1118
- bcx : & ' a Block < ' a > ,
1119
- repr : & adt:: Repr ,
1120
- discr : ty:: Disr ,
1121
- fields : & [ ( uint , Gc < ast:: Expr > ) ] ,
1122
- optbase : Option < StructBaseInfo > ,
1123
- dest : Dest )
1124
- -> & ' a Block < ' a > {
1117
+ pub fn trans_adt < ' a > ( bcx : & ' a Block < ' a > ,
1118
+ repr : & adt:: Repr ,
1119
+ discr : ty:: Disr ,
1120
+ fields : & [ ( uint , Gc < ast:: Expr > ) ] ,
1121
+ optbase : Option < StructBaseInfo > ,
1122
+ dest : Dest ) -> & ' a Block < ' a > {
1125
1123
let _icx = push_ctxt ( "trans_adt" ) ;
1126
1124
let fcx = bcx. fcx ;
1127
1125
let mut bcx = bcx;
@@ -1143,8 +1141,6 @@ fn trans_adt<'a>(
1143
1141
// failure occur before the ADT as a whole is ready.
1144
1142
let custom_cleanup_scope = fcx. push_custom_cleanup_scope ( ) ;
1145
1143
1146
- adt:: trans_start_init ( bcx, repr, addr, discr) ;
1147
-
1148
1144
for & ( i, ref e) in fields. iter ( ) {
1149
1145
let dest = adt:: trans_field_ptr ( bcx, repr, addr, discr, i) ;
1150
1146
let e_ty = expr_ty_adjusted ( bcx, & * * e) ;
@@ -1166,6 +1162,8 @@ fn trans_adt<'a>(
1166
1162
}
1167
1163
}
1168
1164
1165
+ adt:: trans_set_discr ( bcx, repr, addr, discr) ;
1166
+
1169
1167
fcx. pop_custom_cleanup_scope ( custom_cleanup_scope) ;
1170
1168
1171
1169
return bcx;
0 commit comments