@@ -10,6 +10,8 @@ use crate::{cmp, fmt, hash, mem, num};
10
10
/// are likely not to be supported by actual allocators and linkers.
11
11
#[ unstable( feature = "ptr_alignment_type" , issue = "102070" ) ]
12
12
#[ derive( Copy , Clone , Eq ) ]
13
+ #[ cfg_attr( bootstrap, derive( PartialEq ) ) ]
14
+ #[ cfg_attr( not( bootstrap) , derive_const( PartialEq ) ) ]
13
15
#[ repr( transparent) ]
14
16
pub struct Alignment ( AlignmentEnum ) ;
15
17
@@ -167,15 +169,6 @@ impl From<Alignment> for usize {
167
169
}
168
170
}
169
171
170
- #[ rustc_const_unstable( feature = "const_alloc_layout" , issue = "67521" ) ]
171
- #[ unstable( feature = "ptr_alignment_type" , issue = "102070" ) ]
172
- impl const cmp:: PartialEq for Alignment {
173
- #[ inline]
174
- fn eq ( & self , other : & Self ) -> bool {
175
- self . as_nonzero ( ) . get ( ) == other. as_nonzero ( ) . get ( )
176
- }
177
- }
178
-
179
172
#[ rustc_const_unstable( feature = "const_alloc_layout" , issue = "67521" ) ]
180
173
#[ unstable( feature = "ptr_alignment_type" , issue = "102070" ) ]
181
174
impl const cmp:: Ord for Alignment {
@@ -209,7 +202,9 @@ type AlignmentEnum = AlignmentEnum32;
209
202
#[ cfg( target_pointer_width = "64" ) ]
210
203
type AlignmentEnum = AlignmentEnum64 ;
211
204
212
- #[ derive( Copy , Clone , Eq , PartialEq ) ]
205
+ #[ derive( Copy , Clone , Eq ) ]
206
+ #[ cfg_attr( bootstrap, derive( PartialEq ) ) ]
207
+ #[ cfg_attr( not( bootstrap) , derive_const( PartialEq ) ) ]
213
208
#[ repr( u16 ) ]
214
209
enum AlignmentEnum16 {
215
210
_Align1Shl0 = 1 << 0 ,
@@ -230,7 +225,9 @@ enum AlignmentEnum16 {
230
225
_Align1Shl15 = 1 << 15 ,
231
226
}
232
227
233
- #[ derive( Copy , Clone , Eq , PartialEq ) ]
228
+ #[ derive( Copy , Clone , Eq ) ]
229
+ #[ cfg_attr( bootstrap, derive( PartialEq ) ) ]
230
+ #[ cfg_attr( not( bootstrap) , derive_const( PartialEq ) ) ]
234
231
#[ repr( u32 ) ]
235
232
enum AlignmentEnum32 {
236
233
_Align1Shl0 = 1 << 0 ,
@@ -267,7 +264,9 @@ enum AlignmentEnum32 {
267
264
_Align1Shl31 = 1 << 31 ,
268
265
}
269
266
270
- #[ derive( Copy , Clone , Eq , PartialEq ) ]
267
+ #[ derive( Copy , Clone , Eq ) ]
268
+ #[ cfg_attr( bootstrap, derive( PartialEq ) ) ]
269
+ #[ cfg_attr( not( bootstrap) , derive_const( PartialEq ) ) ]
271
270
#[ repr( u64 ) ]
272
271
enum AlignmentEnum64 {
273
272
_Align1Shl0 = 1 << 0 ,
0 commit comments