@@ -778,7 +778,6 @@ pub enum Abi {
778
778
Aggregate {
779
779
/// If true, the size is exact, otherwise it's only a lower bound.
780
780
sized : bool ,
781
- packed : bool
782
781
}
783
782
}
784
783
@@ -790,18 +789,7 @@ impl Abi {
790
789
Abi :: Scalar ( _) |
791
790
Abi :: ScalarPair ( ..) |
792
791
Abi :: Vector { .. } => false ,
793
- Abi :: Aggregate { sized, .. } => !sized
794
- }
795
- }
796
-
797
- /// Returns true if the fields of the layout are packed.
798
- pub fn is_packed ( & self ) -> bool {
799
- match * self {
800
- Abi :: Uninhabited |
801
- Abi :: Scalar ( _) |
802
- Abi :: ScalarPair ( ..) |
803
- Abi :: Vector { .. } => false ,
804
- Abi :: Aggregate { packed, .. } => packed
792
+ Abi :: Aggregate { sized } => !sized
805
793
}
806
794
}
807
795
}
@@ -1077,10 +1065,7 @@ impl<'a, 'tcx> LayoutDetails {
1077
1065
}
1078
1066
1079
1067
let size = min_size. abi_align ( align) ;
1080
- let mut abi = Abi :: Aggregate {
1081
- sized,
1082
- packed
1083
- } ;
1068
+ let mut abi = Abi :: Aggregate { sized } ;
1084
1069
1085
1070
// Unpack newtype ABIs and find scalar pairs.
1086
1071
if sized && size. bytes ( ) > 0 {
@@ -1254,10 +1239,7 @@ impl<'a, 'tcx> LayoutDetails {
1254
1239
stride : element. size ,
1255
1240
count
1256
1241
} ,
1257
- abi : Abi :: Aggregate {
1258
- sized : true ,
1259
- packed : false
1260
- } ,
1242
+ abi : Abi :: Aggregate { sized : true } ,
1261
1243
align : element. align ,
1262
1244
size
1263
1245
} )
@@ -1270,10 +1252,7 @@ impl<'a, 'tcx> LayoutDetails {
1270
1252
stride : element. size ,
1271
1253
count : 0
1272
1254
} ,
1273
- abi : Abi :: Aggregate {
1274
- sized : false ,
1275
- packed : false
1276
- } ,
1255
+ abi : Abi :: Aggregate { sized : false } ,
1277
1256
align : element. align ,
1278
1257
size : Size :: from_bytes ( 0 )
1279
1258
} )
@@ -1285,10 +1264,7 @@ impl<'a, 'tcx> LayoutDetails {
1285
1264
stride : Size :: from_bytes ( 1 ) ,
1286
1265
count : 0
1287
1266
} ,
1288
- abi : Abi :: Aggregate {
1289
- sized : false ,
1290
- packed : false
1291
- } ,
1267
+ abi : Abi :: Aggregate { sized : false } ,
1292
1268
align : dl. i8_align ,
1293
1269
size : Size :: from_bytes ( 0 )
1294
1270
} )
@@ -1302,7 +1278,7 @@ impl<'a, 'tcx> LayoutDetails {
1302
1278
let mut unit = univariant_uninterned ( & [ ] , & ReprOptions :: default ( ) ,
1303
1279
StructKind :: AlwaysSized ) ?;
1304
1280
match unit. abi {
1305
- Abi :: Aggregate { ref mut sized, .. } => * sized = false ,
1281
+ Abi :: Aggregate { ref mut sized } => * sized = false ,
1306
1282
_ => bug ! ( )
1307
1283
}
1308
1284
tcx. intern_layout ( unit)
@@ -1418,10 +1394,7 @@ impl<'a, 'tcx> LayoutDetails {
1418
1394
return Ok ( tcx. intern_layout ( LayoutDetails {
1419
1395
variants : Variants :: Single { index : 0 } ,
1420
1396
fields : FieldPlacement :: Union ( variants[ 0 ] . len ( ) ) ,
1421
- abi : Abi :: Aggregate {
1422
- sized : true ,
1423
- packed
1424
- } ,
1397
+ abi : Abi :: Aggregate { sized : true } ,
1425
1398
align,
1426
1399
size : size. abi_align ( align)
1427
1400
} ) ) ;
@@ -1525,15 +1498,10 @@ impl<'a, 'tcx> LayoutDetails {
1525
1498
let abi = if offset. bytes ( ) == 0 && niche. value . size ( dl) == size {
1526
1499
Abi :: Scalar ( niche. clone ( ) )
1527
1500
} else {
1528
- let mut packed = st[ i] . abi . is_packed ( ) ;
1529
1501
if offset. abi_align ( niche_align) != offset {
1530
- packed = true ;
1531
1502
niche_align = dl. i8_align ;
1532
1503
}
1533
- Abi :: Aggregate {
1534
- sized : true ,
1535
- packed
1536
- }
1504
+ Abi :: Aggregate { sized : true }
1537
1505
} ;
1538
1506
align = align. max ( niche_align) ;
1539
1507
@@ -1681,10 +1649,7 @@ impl<'a, 'tcx> LayoutDetails {
1681
1649
let abi = if discr. value . size ( dl) == size {
1682
1650
Abi :: Scalar ( discr. clone ( ) )
1683
1651
} else {
1684
- Abi :: Aggregate {
1685
- sized : true ,
1686
- packed : false
1687
- }
1652
+ Abi :: Aggregate { sized : true }
1688
1653
} ;
1689
1654
tcx. intern_layout ( LayoutDetails {
1690
1655
variants : Variants :: Tagged {
@@ -2277,19 +2242,14 @@ impl<'a, 'tcx> TyLayout<'tcx> {
2277
2242
self . abi . is_unsized ( )
2278
2243
}
2279
2244
2280
- /// Returns true if the fields of the layout are packed.
2281
- pub fn is_packed ( & self ) -> bool {
2282
- self . abi . is_packed ( )
2283
- }
2284
-
2285
2245
/// Returns true if the type is a ZST and not unsized.
2286
2246
pub fn is_zst ( & self ) -> bool {
2287
2247
match self . abi {
2288
2248
Abi :: Uninhabited => true ,
2289
2249
Abi :: Scalar ( _) |
2290
2250
Abi :: ScalarPair ( ..) |
2291
2251
Abi :: Vector { .. } => false ,
2292
- Abi :: Aggregate { sized, .. } => sized && self . size . bytes ( ) == 0
2252
+ Abi :: Aggregate { sized } => sized && self . size . bytes ( ) == 0
2293
2253
}
2294
2254
}
2295
2255
@@ -2452,8 +2412,7 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for Abi {
2452
2412
element. hash_stable ( hcx, hasher) ;
2453
2413
count. hash_stable ( hcx, hasher) ;
2454
2414
}
2455
- Aggregate { packed, sized } => {
2456
- packed. hash_stable ( hcx, hasher) ;
2415
+ Aggregate { sized } => {
2457
2416
sized. hash_stable ( hcx, hasher) ;
2458
2417
}
2459
2418
}
0 commit comments