@@ -197,12 +197,17 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
197197 }
198198
199199 Aggregate ( ref kind, ref operands) => {
200+ // active_field_index is for union initialization.
200201 let ( dest, active_field_index) = match * * kind {
201202 mir:: AggregateKind :: Adt ( adt_def, variant_index, _, _, active_field_index) => {
202203 self . write_discriminant ( variant_index, & dest) ?;
203204 if adt_def. is_enum ( ) {
204- ( self . place_downcast ( & dest, variant_index) ?, active_field_index)
205+ assert ! ( active_field_index. is_none( ) ) ;
206+ ( self . place_downcast ( & dest, variant_index) ?, None )
205207 } else {
208+ if active_field_index. is_some ( ) {
209+ assert_eq ! ( operands. len( ) , 1 ) ;
210+ }
206211 ( dest, active_field_index)
207212 }
208213 }
@@ -211,12 +216,9 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
211216
212217 for ( i, operand) in operands. iter ( ) . enumerate ( ) {
213218 let op = self . eval_operand ( operand, None ) ?;
214- // Ignore zero-sized fields.
215- if !op. layout . is_zst ( ) {
216- let field_index = active_field_index. unwrap_or ( i) ;
217- let field_dest = self . place_field ( & dest, field_index) ?;
218- self . copy_op ( & op, & field_dest) ?;
219- }
219+ let field_index = active_field_index. unwrap_or ( i) ;
220+ let field_dest = self . place_field ( & dest, field_index) ?;
221+ self . copy_op ( & op, & field_dest) ?;
220222 }
221223 }
222224
0 commit comments