@@ -94,7 +94,7 @@ fn align_of_uncached<'tcx>(
9494 assert ! ( size. bits( ) <= 128 ) ;
9595 Scalar :: Initialized { value, valid_range : WrappingRange :: full ( size) }
9696 } ;
97- let scalar = |value : Primitive | tcx . intern_layout ( LayoutS :: scalar ( cx , scalar_unit ( value) ) ) ;
97+ let scalar = |value : Primitive | scalar_unit ( value) . align ( cx ) ;
9898
9999 let univariant = |fields : & [ TyAndLayout < ' _ > ] , repr : & ReprOptions , kind| {
100100 Ok ( tcx. intern_layout ( univariant_uninterned ( cx, ty, fields, repr, kind) ?) )
@@ -103,31 +103,14 @@ fn align_of_uncached<'tcx>(
103103
104104 Ok ( match * ty. kind ( ) {
105105 // Basic scalars.
106- ty:: Bool => tcx
107- . intern_layout ( LayoutS :: scalar (
108- cx,
109- Scalar :: Initialized {
110- value : Int ( I8 , false ) ,
111- valid_range : WrappingRange { start : 0 , end : 1 } ,
112- } ,
113- ) )
114- . align ( ) ,
115- ty:: Char => tcx
116- . intern_layout ( LayoutS :: scalar (
117- cx,
118- Scalar :: Initialized {
119- value : Int ( I32 , false ) ,
120- valid_range : WrappingRange { start : 0 , end : 0x10FFFF } ,
121- } ,
122- ) )
123- . align ( ) ,
124- ty:: Int ( ity) => scalar ( Int ( Integer :: from_int_ty ( dl, ity) , true ) ) . align ( ) ,
125- ty:: Uint ( ity) => scalar ( Int ( Integer :: from_uint_ty ( dl, ity) , false ) ) . align ( ) ,
126- ty:: Float ( fty) => scalar ( match fty {
106+ ty:: Bool => I8 . align ( cx) ,
107+ ty:: Char => I32 . align ( cx) ,
108+ ty:: Int ( ity) => Integer :: from_int_ty ( dl, ity) . align ( cx) ,
109+ ty:: Uint ( ity) => Integer :: from_uint_ty ( dl, ity) . align ( cx) ,
110+ ty:: Float ( fty) => match fty {
127111 ty:: FloatTy :: F32 => F32 ,
128112 ty:: FloatTy :: F64 => F64 ,
129- } )
130- . align ( ) ,
113+ } . align ( cx) ,
131114 ty:: FnPtr ( _) => {
132115 let mut ptr = scalar_unit ( Pointer ( dl. instruction_address_space ) ) ;
133116 ptr. valid_range_mut ( ) . start = 1 ;
0 commit comments