@@ -876,8 +876,8 @@ fn trans_def_dps_unadjusted<'a>(
876876 // Nullary variant.
877877 let ty = expr_ty ( bcx, ref_expr) ;
878878 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 ) ;
881881 return bcx;
882882 }
883883 }
@@ -886,7 +886,7 @@ fn trans_def_dps_unadjusted<'a>(
886886 match ty:: get ( ty) . sty {
887887 ty:: ty_struct( did, _) if ty:: has_dtor ( bcx. tcx ( ) , did) => {
888888 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 ) ;
890890 }
891891 _ => { }
892892 }
@@ -1098,7 +1098,7 @@ fn trans_rec_or_struct<'a>(
10981098 * Note that `fields` may be empty; the base expression must always be
10991099 * evaluated for side-effects.
11001100 */
1101- struct StructBaseInfo {
1101+ pub struct StructBaseInfo {
11021102 /// The base expression; will be evaluated after all explicit fields.
11031103 expr : Gc < ast:: Expr > ,
11041104 /// The indices of fields to copy paired with their types.
@@ -1114,14 +1114,12 @@ struct StructBaseInfo {
11141114 * - `optbase` contains information on the base struct (if any) from
11151115 * which remaining fields are copied; see comments on `StructBaseInfo`.
11161116 */
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 > {
11251123 let _icx = push_ctxt ( "trans_adt" ) ;
11261124 let fcx = bcx. fcx ;
11271125 let mut bcx = bcx;
@@ -1143,8 +1141,6 @@ fn trans_adt<'a>(
11431141 // failure occur before the ADT as a whole is ready.
11441142 let custom_cleanup_scope = fcx. push_custom_cleanup_scope ( ) ;
11451143
1146- adt:: trans_start_init ( bcx, repr, addr, discr) ;
1147-
11481144 for & ( i, ref e) in fields. iter ( ) {
11491145 let dest = adt:: trans_field_ptr ( bcx, repr, addr, discr, i) ;
11501146 let e_ty = expr_ty_adjusted ( bcx, & * * e) ;
@@ -1166,6 +1162,8 @@ fn trans_adt<'a>(
11661162 }
11671163 }
11681164
1165+ adt:: trans_set_discr ( bcx, repr, addr, discr) ;
1166+
11691167 fcx. pop_custom_cleanup_scope ( custom_cleanup_scope) ;
11701168
11711169 return bcx;
0 commit comments