@@ -9,6 +9,7 @@ use hir_expand::{
99 HirFileId , InFile ,
1010} ;
1111use la_arena:: { Arena , ArenaMap } ;
12+ use rustc_abi:: { Integer , IntegerType } ;
1213use syntax:: ast:: { self , HasName , HasVisibility } ;
1314use tt:: { Delimiter , DelimiterKind , Leaf , Subtree , TokenTree } ;
1415
@@ -127,15 +128,32 @@ fn parse_repr_tt(tt: &Subtree) -> Option<ReprOptions> {
127128 . map ( Either :: Left )
128129 . or_else ( || BuiltinUint :: from_suffix ( repr) . map ( Either :: Right ) )
129130 {
130- int = Some ( builtin) ;
131+ int = Some ( match builtin {
132+ Either :: Left ( bi) => match bi {
133+ BuiltinInt :: Isize => IntegerType :: Pointer ( true ) ,
134+ BuiltinInt :: I8 => IntegerType :: Fixed ( Integer :: I8 , true ) ,
135+ BuiltinInt :: I16 => IntegerType :: Fixed ( Integer :: I16 , true ) ,
136+ BuiltinInt :: I32 => IntegerType :: Fixed ( Integer :: I32 , true ) ,
137+ BuiltinInt :: I64 => IntegerType :: Fixed ( Integer :: I64 , true ) ,
138+ BuiltinInt :: I128 => IntegerType :: Fixed ( Integer :: I128 , true ) ,
139+ } ,
140+ Either :: Right ( bu) => match bu {
141+ BuiltinUint :: Usize => IntegerType :: Pointer ( false ) ,
142+ BuiltinUint :: U8 => IntegerType :: Fixed ( Integer :: I8 , false ) ,
143+ BuiltinUint :: U16 => IntegerType :: Fixed ( Integer :: I16 , false ) ,
144+ BuiltinUint :: U32 => IntegerType :: Fixed ( Integer :: I32 , false ) ,
145+ BuiltinUint :: U64 => IntegerType :: Fixed ( Integer :: I64 , false ) ,
146+ BuiltinUint :: U128 => IntegerType :: Fixed ( Integer :: I128 , false ) ,
147+ } ,
148+ } ) ;
131149 }
132150 ReprFlags :: empty ( )
133151 }
134152 } )
135153 }
136154 }
137155
138- Some ( ReprOptions { int, align : max_align, pack : min_pack, flags } )
156+ Some ( ReprOptions { int, align : max_align, pack : min_pack, flags, field_shuffle_seed : 0 } )
139157}
140158
141159impl StructData {
@@ -276,10 +294,10 @@ impl EnumData {
276294 Some ( id)
277295 }
278296
279- pub fn variant_body_type ( & self ) -> Either < BuiltinInt , BuiltinUint > {
297+ pub fn variant_body_type ( & self ) -> IntegerType {
280298 match self . repr {
281299 Some ( ReprOptions { int : Some ( builtin) , .. } ) => builtin,
282- _ => Either :: Left ( BuiltinInt :: Isize ) ,
300+ _ => IntegerType :: Pointer ( true ) ,
283301 }
284302 }
285303}
0 commit comments