@@ -11,7 +11,8 @@ use crate::{cmp, fmt, hash, mem, num};
1111/// Note that particularly large alignments, while representable in this type,
1212/// are likely not to be supported by actual allocators and linkers.
1313#[ unstable( feature = "ptr_alignment_type" , issue = "102070" ) ]
14- #[ derive( Copy , Clone , PartialEq , Eq ) ]
14+ #[ derive( Copy ) ]
15+ #[ derive_const( Clone , PartialEq , Eq ) ]
1516#[ repr( transparent) ]
1617pub struct Alignment {
1718 // This field is never used directly (nor is the enum),
@@ -303,15 +304,17 @@ impl const From<Alignment> for usize {
303304}
304305
305306#[ unstable( feature = "ptr_alignment_type" , issue = "102070" ) ]
306- impl cmp:: Ord for Alignment {
307+ #[ rustc_const_unstable( feature = "const_cmp" , issue = "143800" ) ]
308+ impl const cmp:: Ord for Alignment {
307309 #[ inline]
308310 fn cmp ( & self , other : & Self ) -> cmp:: Ordering {
309311 self . as_nonzero_usize ( ) . cmp ( & other. as_nonzero_usize ( ) )
310312 }
311313}
312314
313315#[ unstable( feature = "ptr_alignment_type" , issue = "102070" ) ]
314- impl cmp:: PartialOrd for Alignment {
316+ #[ rustc_const_unstable( feature = "const_cmp" , issue = "143800" ) ]
317+ impl const cmp:: PartialOrd for Alignment {
315318 #[ inline]
316319 fn partial_cmp ( & self , other : & Self ) -> Option < cmp:: Ordering > {
317320 Some ( self . cmp ( other) )
@@ -336,7 +339,8 @@ impl const Default for Alignment {
336339}
337340
338341#[ cfg( target_pointer_width = "16" ) ]
339- #[ derive( Copy , Clone , PartialEq , Eq ) ]
342+ #[ derive( Copy ) ]
343+ #[ derive_const( Clone , PartialEq , Eq ) ]
340344#[ repr( usize ) ]
341345enum AlignmentEnum {
342346 _Align1Shl0 = 1 << 0 ,
@@ -358,7 +362,8 @@ enum AlignmentEnum {
358362}
359363
360364#[ cfg( target_pointer_width = "32" ) ]
361- #[ derive( Copy , Clone , PartialEq , Eq ) ]
365+ #[ derive( Copy ) ]
366+ #[ derive_const( Clone , PartialEq , Eq ) ]
362367#[ repr( usize ) ]
363368enum AlignmentEnum {
364369 _Align1Shl0 = 1 << 0 ,
@@ -396,7 +401,8 @@ enum AlignmentEnum {
396401}
397402
398403#[ cfg( target_pointer_width = "64" ) ]
399- #[ derive( Copy , Clone , PartialEq , Eq ) ]
404+ #[ derive( Copy ) ]
405+ #[ derive_const( Clone , PartialEq , Eq ) ]
400406#[ repr( usize ) ]
401407enum AlignmentEnum {
402408 _Align1Shl0 = 1 << 0 ,
0 commit comments