@@ -10,6 +10,8 @@ use crate::{cmp, fmt, hash, mem, num};
1010/// are likely not to be supported by actual allocators and linkers.
1111#[ unstable( feature = "ptr_alignment_type" , issue = "102070" ) ]
1212#[ derive( Copy , Clone , Eq ) ]
13+ #[ cfg_attr( bootstrap, derive( PartialEq ) ) ]
14+ #[ cfg_attr( not( bootstrap) , derive_const( PartialEq ) ) ]
1315#[ repr( transparent) ]
1416pub struct Alignment ( AlignmentEnum ) ;
1517
@@ -167,15 +169,6 @@ impl From<Alignment> for usize {
167169 }
168170}
169171
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-
179172#[ rustc_const_unstable( feature = "const_alloc_layout" , issue = "67521" ) ]
180173#[ unstable( feature = "ptr_alignment_type" , issue = "102070" ) ]
181174impl const cmp:: Ord for Alignment {
@@ -209,7 +202,9 @@ type AlignmentEnum = AlignmentEnum32;
209202#[ cfg( target_pointer_width = "64" ) ]
210203type AlignmentEnum = AlignmentEnum64 ;
211204
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 ) ) ]
213208#[ repr( u16 ) ]
214209enum AlignmentEnum16 {
215210 _Align1Shl0 = 1 << 0 ,
@@ -230,7 +225,9 @@ enum AlignmentEnum16 {
230225 _Align1Shl15 = 1 << 15 ,
231226}
232227
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 ) ) ]
234231#[ repr( u32 ) ]
235232enum AlignmentEnum32 {
236233 _Align1Shl0 = 1 << 0 ,
@@ -267,7 +264,9 @@ enum AlignmentEnum32 {
267264 _Align1Shl31 = 1 << 31 ,
268265}
269266
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 ) ) ]
271270#[ repr( u64 ) ]
272271enum AlignmentEnum64 {
273272 _Align1Shl0 = 1 << 0 ,
0 commit comments