@@ -259,7 +259,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> {
259259
260260 let pack = {
261261 let pack = repr. pack as u64 ;
262- AbiAndPrefAlign :: from_bytes ( pack, pack ) . unwrap ( )
262+ AbiAndPrefAlign :: new ( Align :: from_bytes ( pack) . unwrap ( ) )
263263 } ;
264264
265265 let mut align = if packed {
@@ -274,7 +274,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> {
274274
275275 let mut optimize = !repr. inhibit_struct_field_reordering_opt ( ) ;
276276 if let StructKind :: Prefixed ( _, align) = kind {
277- optimize &= align. abi ( ) == 1 ;
277+ optimize &= align. abi . bytes ( ) == 1 ;
278278 }
279279
280280 if optimize {
@@ -285,7 +285,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> {
285285 } ;
286286 let optimizing = & mut inverse_memory_index[ ..end] ;
287287 let field_align = |f : & TyLayout < ' _ > | {
288- if packed { f. align . min ( pack) . abi ( ) } else { f. align . abi ( ) }
288+ if packed { f. align . min ( pack) . abi } else { f. align . abi }
289289 } ;
290290 match kind {
291291 StructKind :: AlwaysSized |
@@ -352,7 +352,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> {
352352
353353 if repr. align > 0 {
354354 let repr_align = repr. align as u64 ;
355- align = align. max ( AbiAndPrefAlign :: from_bytes ( repr_align, repr_align ) . unwrap ( ) ) ;
355+ align = align. max ( AbiAndPrefAlign :: new ( Align :: from_bytes ( repr_align) . unwrap ( ) ) ) ;
356356 debug ! ( "univariant repr_align: {:?}" , repr_align) ;
357357 }
358358
@@ -394,7 +394,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> {
394394 ( Some ( ( i, field) ) , None , None ) => {
395395 // Field fills the struct and it has a scalar or scalar pair ABI.
396396 if offsets[ i] . bytes ( ) == 0 &&
397- align. abi ( ) == field. align . abi ( ) &&
397+ align. abi == field. align . abi &&
398398 size == field. size {
399399 match field. abi {
400400 // For plain scalars, or vectors of them, we can't unpack
@@ -682,7 +682,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> {
682682
683683 let pack = {
684684 let pack = def. repr . pack as u64 ;
685- AbiAndPrefAlign :: from_bytes ( pack, pack ) . unwrap ( )
685+ AbiAndPrefAlign :: new ( Align :: from_bytes ( pack) . unwrap ( ) )
686686 } ;
687687
688688 let mut align = if packed {
@@ -694,7 +694,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> {
694694 if def. repr . align > 0 {
695695 let repr_align = def. repr . align as u64 ;
696696 align = align. max (
697- AbiAndPrefAlign :: from_bytes ( repr_align, repr_align ) . unwrap ( ) ) ;
697+ AbiAndPrefAlign :: new ( Align :: from_bytes ( repr_align) . unwrap ( ) ) ) ;
698698 }
699699
700700 let optimize = !def. repr . inhibit_union_abi_opt ( ) ;
@@ -964,7 +964,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> {
964964 let mut size = Size :: ZERO ;
965965
966966 // We're interested in the smallest alignment, so start large.
967- let mut start_align = AbiAndPrefAlign :: from_bytes ( 256 , 256 ) . unwrap ( ) ;
967+ let mut start_align = AbiAndPrefAlign :: new ( Align :: from_bytes ( 256 ) . unwrap ( ) ) ;
968968 assert_eq ! ( Integer :: for_abi_align( dl, start_align) , None ) ;
969969
970970 // repr(C) on an enum tells us to make a (tag, union) layout,
@@ -989,7 +989,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> {
989989 // Find the first field we can't move later
990990 // to make room for a larger discriminant.
991991 for field in st. fields . index_by_increasing_offset ( ) . map ( |j| field_layouts[ j] ) {
992- if !field. is_zst ( ) || field. align . abi ( ) != 1 {
992+ if !field. is_zst ( ) || field. align . abi . bytes ( ) != 1 {
993993 start_align = start_align. min ( field. align ) ;
994994 break ;
995995 }
@@ -1251,7 +1251,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> {
12511251 name : name. to_string ( ) ,
12521252 offset : offset. bytes ( ) ,
12531253 size : field_layout. size . bytes ( ) ,
1254- align : field_layout. align . abi ( ) ,
1254+ align : field_layout. align . abi . bytes ( ) ,
12551255 }
12561256 }
12571257 }
@@ -1264,7 +1264,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> {
12641264 } else {
12651265 session:: SizeKind :: Exact
12661266 } ,
1267- align : layout. align . abi ( ) ,
1267+ align : layout. align . abi . bytes ( ) ,
12681268 size : if min_size. bytes ( ) == 0 {
12691269 layout. size . bytes ( )
12701270 } else {
@@ -1994,12 +1994,16 @@ impl_stable_hash_for!(enum ::ty::layout::Primitive {
19941994 Pointer
19951995} ) ;
19961996
1997- impl < ' gcx > HashStable < StableHashingContext < ' gcx > > for AbiAndPrefAlign {
1997+ impl_stable_hash_for ! ( struct :: ty:: layout:: AbiAndPrefAlign {
1998+ abi,
1999+ pref
2000+ } ) ;
2001+
2002+ impl < ' gcx > HashStable < StableHashingContext < ' gcx > > for Align {
19982003 fn hash_stable < W : StableHasherResult > ( & self ,
19992004 hcx : & mut StableHashingContext < ' gcx > ,
20002005 hasher : & mut StableHasher < W > ) {
2001- self . abi ( ) . hash_stable ( hcx, hasher) ;
2002- self . pref ( ) . hash_stable ( hcx, hasher) ;
2006+ self . bytes ( ) . hash_stable ( hcx, hasher) ;
20032007 }
20042008}
20052009
0 commit comments