@@ -134,15 +134,10 @@ fn univariant_uninterned<'tcx>(
134
134
cx : & LayoutCx < ' tcx > ,
135
135
ty : Ty < ' tcx > ,
136
136
fields : & IndexSlice < FieldIdx , TyAndLayout < ' tcx > > ,
137
- repr : & ReprOptions ,
138
137
kind : StructKind ,
139
138
) -> Result < LayoutData < FieldIdx , VariantIdx > , & ' tcx LayoutError < ' tcx > > {
140
- let pack = repr. pack ;
141
- if pack. is_some ( ) && repr. align . is_some ( ) {
142
- cx. tcx ( ) . dcx ( ) . bug ( "struct cannot be packed and aligned" ) ;
143
- }
144
-
145
- cx. calc . univariant ( fields, repr, kind) . map_err ( |err| map_error ( cx, ty, err) )
139
+ let repr = ReprOptions :: default ( ) ;
140
+ cx. calc . univariant ( fields, & repr, kind) . map_err ( |err| map_error ( cx, ty, err) )
146
141
}
147
142
148
143
fn extract_const_value < ' tcx > (
@@ -189,10 +184,9 @@ fn layout_of_uncached<'tcx>(
189
184
} ;
190
185
let scalar = |value : Primitive | tcx. mk_layout ( LayoutData :: scalar ( cx, scalar_unit ( value) ) ) ;
191
186
192
- let univariant =
193
- |fields : & IndexSlice < FieldIdx , TyAndLayout < ' tcx > > , repr : & ReprOptions , kind| {
194
- Ok ( tcx. mk_layout ( univariant_uninterned ( cx, ty, fields, repr, kind) ?) )
195
- } ;
187
+ let univariant = |fields : & IndexSlice < FieldIdx , TyAndLayout < ' tcx > > , kind| {
188
+ Ok ( tcx. mk_layout ( univariant_uninterned ( cx, ty, fields, kind) ?) )
189
+ } ;
196
190
debug_assert ! ( !ty. has_non_region_infer( ) ) ;
197
191
198
192
Ok ( match * ty. kind ( ) {
@@ -405,17 +399,10 @@ fn layout_of_uncached<'tcx>(
405
399
} ) ,
406
400
407
401
// Odd unit types.
408
- ty:: FnDef ( ..) => {
409
- univariant ( IndexSlice :: empty ( ) , & ReprOptions :: default ( ) , StructKind :: AlwaysSized ) ?
410
- }
402
+ ty:: FnDef ( ..) => univariant ( IndexSlice :: empty ( ) , StructKind :: AlwaysSized ) ?,
411
403
ty:: Dynamic ( _, _, ty:: Dyn ) | ty:: Foreign ( ..) => {
412
- let mut unit = univariant_uninterned (
413
- cx,
414
- ty,
415
- IndexSlice :: empty ( ) ,
416
- & ReprOptions :: default ( ) ,
417
- StructKind :: AlwaysSized ,
418
- ) ?;
404
+ let mut unit =
405
+ univariant_uninterned ( cx, ty, IndexSlice :: empty ( ) , StructKind :: AlwaysSized ) ?;
419
406
match unit. backend_repr {
420
407
BackendRepr :: Memory { ref mut sized } => * sized = false ,
421
408
_ => bug ! ( ) ,
@@ -429,7 +416,6 @@ fn layout_of_uncached<'tcx>(
429
416
let tys = args. as_closure ( ) . upvar_tys ( ) ;
430
417
univariant (
431
418
& tys. iter ( ) . map ( |ty| cx. layout_of ( ty) ) . try_collect :: < IndexVec < _ , _ > > ( ) ?,
432
- & ReprOptions :: default ( ) ,
433
419
StructKind :: AlwaysSized ,
434
420
) ?
435
421
}
@@ -438,7 +424,6 @@ fn layout_of_uncached<'tcx>(
438
424
let tys = args. as_coroutine_closure ( ) . upvar_tys ( ) ;
439
425
univariant (
440
426
& tys. iter ( ) . map ( |ty| cx. layout_of ( ty) ) . try_collect :: < IndexVec < _ , _ > > ( ) ?,
441
- & ReprOptions :: default ( ) ,
442
427
StructKind :: AlwaysSized ,
443
428
) ?
444
429
}
@@ -447,11 +432,7 @@ fn layout_of_uncached<'tcx>(
447
432
let kind =
448
433
if tys. len ( ) == 0 { StructKind :: AlwaysSized } else { StructKind :: MaybeUnsized } ;
449
434
450
- univariant (
451
- & tys. iter ( ) . map ( |k| cx. layout_of ( k) ) . try_collect :: < IndexVec < _ , _ > > ( ) ?,
452
- & ReprOptions :: default ( ) ,
453
- kind,
454
- ) ?
435
+ univariant ( & tys. iter ( ) . map ( |k| cx. layout_of ( k) ) . try_collect :: < IndexVec < _ , _ > > ( ) ?, kind) ?
455
436
}
456
437
457
438
// SIMD vector types.
@@ -902,13 +883,7 @@ fn coroutine_layout<'tcx>(
902
883
. chain ( iter:: once ( Ok ( tag_layout) ) )
903
884
. chain ( promoted_layouts)
904
885
. try_collect :: < IndexVec < _ , _ > > ( ) ?;
905
- let prefix = univariant_uninterned (
906
- cx,
907
- ty,
908
- & prefix_layouts,
909
- & ReprOptions :: default ( ) ,
910
- StructKind :: AlwaysSized ,
911
- ) ?;
886
+ let prefix = univariant_uninterned ( cx, ty, & prefix_layouts, StructKind :: AlwaysSized ) ?;
912
887
913
888
let ( prefix_size, prefix_align) = ( prefix. size , prefix. align ) ;
914
889
@@ -973,7 +948,6 @@ fn coroutine_layout<'tcx>(
973
948
cx,
974
949
ty,
975
950
& variant_only_tys. map ( |ty| cx. layout_of ( ty) ) . try_collect :: < IndexVec < _ , _ > > ( ) ?,
976
- & ReprOptions :: default ( ) ,
977
951
StructKind :: Prefixed ( prefix_size, prefix_align. abi ) ,
978
952
) ?;
979
953
variant. variants = Variants :: Single { index } ;
0 commit comments