@@ -7,7 +7,6 @@ use either::Either;
7
7
use rustc_middle:: mir;
8
8
use rustc_middle:: mir:: interpret:: { InterpResult , Scalar } ;
9
9
use rustc_middle:: ty:: layout:: LayoutOf ;
10
- use rustc_target:: abi:: VariantIdx ;
11
10
12
11
use super :: { ImmTy , InterpCx , Machine } ;
13
12
@@ -200,24 +199,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
200
199
}
201
200
202
201
Aggregate ( box ref kind, ref operands) => {
203
- self . write_uninit ( & dest) ?;
204
- let ( variant_index, variant_dest, active_field_index) = match * kind {
205
- mir:: AggregateKind :: Adt ( _, variant_index, _, _, active_field_index) => {
206
- let variant_dest = self . place_downcast ( & dest, variant_index) ?;
207
- ( variant_index, variant_dest, active_field_index)
208
- }
209
- _ => ( VariantIdx :: from_u32 ( 0 ) , dest. clone ( ) , None ) ,
210
- } ;
211
- if active_field_index. is_some ( ) {
212
- assert_eq ! ( operands. len( ) , 1 ) ;
213
- }
214
- for ( field_index, operand) in operands. iter ( ) . enumerate ( ) {
215
- let field_index = active_field_index. unwrap_or ( field_index) ;
216
- let field_dest = self . place_field ( & variant_dest, field_index) ?;
217
- let op = self . eval_operand ( operand, Some ( field_dest. layout ) ) ?;
218
- self . copy_op ( & op, & field_dest, /*allow_transmute*/ false ) ?;
219
- }
220
- self . write_discriminant ( variant_index, & dest) ?;
202
+ self . write_aggregate ( kind, operands, & dest) ?;
221
203
}
222
204
223
205
Repeat ( ref operand, _) => {
0 commit comments