@@ -267,6 +267,9 @@ impl TargetDataLayout {
267
267
[ "a" , ref a @ ..] => dl. aggregate_align = align ( a, "a" ) ?,
268
268
[ "f32" , ref a @ ..] => dl. f32_align = align ( a, "f32" ) ?,
269
269
[ "f64" , ref a @ ..] => dl. f64_align = align ( a, "f64" ) ?,
270
+ // FIXME(erikdesjardins): we should be parsing nonzero address spaces
271
+ // this will require replacing TargetDataLayout::{pointer_size,pointer_align}
272
+ // with e.g. `fn pointer_size_in(AddressSpace)`
270
273
[ p @ "p" , s, ref a @ ..] | [ p @ "p0" , s, ref a @ ..] => {
271
274
dl. pointer_size = size ( s, p) ?;
272
275
dl. pointer_align = align ( a, p) ?;
@@ -861,7 +864,7 @@ pub enum Primitive {
861
864
Int ( Integer , bool ) ,
862
865
F32 ,
863
866
F64 ,
864
- Pointer ,
867
+ Pointer ( AddressSpace ) ,
865
868
}
866
869
867
870
impl Primitive {
@@ -872,7 +875,10 @@ impl Primitive {
872
875
Int ( i, _) => i. size ( ) ,
873
876
F32 => Size :: from_bits ( 32 ) ,
874
877
F64 => Size :: from_bits ( 64 ) ,
875
- Pointer => dl. pointer_size ,
878
+ // FIXME(erikdesjardins): ignoring address space is technically wrong, pointers in
879
+ // different address spaces can have different sizes
880
+ // (but TargetDataLayout doesn't currently parse that part of the DL string)
881
+ Pointer ( _) => dl. pointer_size ,
876
882
}
877
883
}
878
884
@@ -883,14 +889,12 @@ impl Primitive {
883
889
Int ( i, _) => i. align ( dl) ,
884
890
F32 => dl. f32_align ,
885
891
F64 => dl. f64_align ,
886
- Pointer => dl. pointer_align ,
892
+ // FIXME(erikdesjardins): ignoring address space is technically wrong, pointers in
893
+ // different address spaces can have different alignments
894
+ // (but TargetDataLayout doesn't currently parse that part of the DL string)
895
+ Pointer ( _) => dl. pointer_align ,
887
896
}
888
897
}
889
-
890
- #[ inline]
891
- pub fn is_ptr ( self ) -> bool {
892
- matches ! ( self , Pointer )
893
- }
894
898
}
895
899
896
900
/// Inclusive wrap-around range of valid values, that is, if
@@ -1176,7 +1180,8 @@ impl FieldsShape {
1176
1180
/// An identifier that specifies the address space that some operation
1177
1181
/// should operate on. Special address spaces have an effect on code generation,
1178
1182
/// depending on the target and the address spaces it implements.
1179
- #[ derive( Copy , Clone , Debug , PartialEq , Eq , PartialOrd , Ord ) ]
1183
+ #[ derive( Copy , Clone , Debug , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
1184
+ #[ cfg_attr( feature = "nightly" , derive( HashStable_Generic ) ) ]
1180
1185
pub struct AddressSpace ( pub u32 ) ;
1181
1186
1182
1187
impl AddressSpace {
@@ -1456,7 +1461,6 @@ pub struct PointeeInfo {
1456
1461
pub size : Size ,
1457
1462
pub align : Align ,
1458
1463
pub safe : Option < PointerKind > ,
1459
- pub address_space : AddressSpace ,
1460
1464
}
1461
1465
1462
1466
/// Used in `might_permit_raw_init` to indicate the kind of initialisation
0 commit comments