@@ -9,7 +9,7 @@ use crate::interpret::{
9
9
} ;
10
10
use rustc_middle:: ty:: { self , ScalarInt , Ty , TyCtxt } ;
11
11
use rustc_span:: source_map:: DUMMY_SP ;
12
- use rustc_target:: abi:: { Align , FieldIdx , VariantIdx , FIRST_VARIANT } ;
12
+ use rustc_target:: abi:: { Align , VariantIdx } ;
13
13
14
14
#[ instrument( skip( ecx) , level = "debug" ) ]
15
15
fn branches < ' tcx > (
@@ -399,45 +399,8 @@ fn valtree_into_mplace<'tcx>(
399
399
debug ! ( ?i, ?inner_valtree) ;
400
400
401
401
let place_inner = match ty. kind ( ) {
402
- ty:: Str | ty:: Slice ( _) => ecx. project_index ( place, i as u64 ) . unwrap ( ) ,
403
- _ if !ty. is_sized ( * ecx. tcx , ty:: ParamEnv :: empty ( ) )
404
- && i == branches. len ( ) - 1 =>
405
- {
406
- // Note: For custom DSTs we need to manually process the last unsized field.
407
- // We created a `Pointer` for the `Allocation` of the complete sized version of
408
- // the Adt in `create_pointee_place` and now we fill that `Allocation` with the
409
- // values in the ValTree. For the unsized field we have to additionally add the meta
410
- // data.
411
-
412
- let ( unsized_inner_ty, num_elems) =
413
- get_info_on_unsized_field ( ty, valtree, tcx) ;
414
- debug ! ( ?unsized_inner_ty) ;
415
-
416
- let inner_ty = match ty. kind ( ) {
417
- ty:: Adt ( def, args) => {
418
- let i = FieldIdx :: from_usize ( i) ;
419
- def. variant ( FIRST_VARIANT ) . fields [ i] . ty ( tcx, args)
420
- }
421
- ty:: Tuple ( inner_tys) => inner_tys[ i] ,
422
- _ => bug ! ( "unexpected unsized type {:?}" , ty) ,
423
- } ;
424
-
425
- let inner_layout =
426
- tcx. layout_of ( ty:: ParamEnv :: empty ( ) . and ( inner_ty) ) . unwrap ( ) ;
427
- debug ! ( ?inner_layout) ;
428
-
429
- let offset = place_adjusted. layout . fields . offset ( i) ;
430
- place
431
- . offset_with_meta (
432
- offset,
433
- MemPlaceMeta :: Meta ( Scalar :: from_target_usize (
434
- num_elems as u64 ,
435
- & tcx,
436
- ) ) ,
437
- inner_layout,
438
- & tcx,
439
- )
440
- . unwrap ( )
402
+ ty:: Str | ty:: Slice ( _) | ty:: Array ( ..) => {
403
+ ecx. project_index ( place, i as u64 ) . unwrap ( )
441
404
}
442
405
_ => ecx. project_field ( & place_adjusted, i) . unwrap ( ) ,
443
406
} ;
0 commit comments