@@ -9,6 +9,7 @@ use hir_expand::{
9
9
HirFileId , InFile ,
10
10
} ;
11
11
use la_arena:: { Arena , ArenaMap } ;
12
+ use rustc_abi:: { Integer , IntegerType } ;
12
13
use syntax:: ast:: { self , HasName , HasVisibility } ;
13
14
use tt:: { Delimiter , DelimiterKind , Leaf , Subtree , TokenTree } ;
14
15
@@ -127,15 +128,32 @@ fn parse_repr_tt(tt: &Subtree) -> Option<ReprOptions> {
127
128
. map ( Either :: Left )
128
129
. or_else ( || BuiltinUint :: from_suffix ( repr) . map ( Either :: Right ) )
129
130
{
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
+ } ) ;
131
149
}
132
150
ReprFlags :: empty ( )
133
151
}
134
152
} )
135
153
}
136
154
}
137
155
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 } )
139
157
}
140
158
141
159
impl StructData {
@@ -276,10 +294,10 @@ impl EnumData {
276
294
Some ( id)
277
295
}
278
296
279
- pub fn variant_body_type ( & self ) -> Either < BuiltinInt , BuiltinUint > {
297
+ pub fn variant_body_type ( & self ) -> IntegerType {
280
298
match self . repr {
281
299
Some ( ReprOptions { int : Some ( builtin) , .. } ) => builtin,
282
- _ => Either :: Left ( BuiltinInt :: Isize ) ,
300
+ _ => IntegerType :: Pointer ( true ) ,
283
301
}
284
302
}
285
303
}
0 commit comments