@@ -38,7 +38,8 @@ use crate::hash::Hash;
3838/// [slicing index]: crate::slice::SliceIndex
3939#[ lang = "RangeFull" ]
4040#[ doc( alias = ".." ) ]
41- #[ derive( Copy , Clone , Default , PartialEq , Eq , Hash ) ]
41+ #[ derive( Eq , Hash ) ]
42+ #[ derive_const( Copy , Clone , Default , PartialEq ) ]
4243#[ stable( feature = "rust1" , since = "1.0.0" ) ]
4344pub struct RangeFull ;
4445
@@ -75,7 +76,8 @@ impl fmt::Debug for RangeFull {
7576/// ```
7677#[ lang = "Range" ]
7778#[ doc( alias = ".." ) ]
78- #[ derive( Clone , Default , PartialEq , Eq , Hash ) ] // not Copy -- see #27186
79+ #[ derive( Eq , Hash ) ]
80+ #[ derive_const( Clone , Default , PartialEq ) ] // not Copy -- see #27186
7981#[ stable( feature = "rust1" , since = "1.0.0" ) ]
8082pub struct Range < Idx > {
8183 /// The lower bound of the range (inclusive).
@@ -184,7 +186,8 @@ impl<Idx: PartialOrd<Idx>> Range<Idx> {
184186/// ```
185187#[ lang = "RangeFrom" ]
186188#[ doc( alias = ".." ) ]
187- #[ derive( Clone , PartialEq , Eq , Hash ) ] // not Copy -- see #27186
189+ #[ derive( Eq , Hash ) ]
190+ #[ derive_const( Clone , PartialEq ) ] // not Copy -- see #27186
188191#[ stable( feature = "rust1" , since = "1.0.0" ) ]
189192pub struct RangeFrom < Idx > {
190193 /// The lower bound of the range (inclusive).
@@ -266,7 +269,8 @@ impl<Idx: PartialOrd<Idx>> RangeFrom<Idx> {
266269/// [slicing index]: crate::slice::SliceIndex
267270#[ lang = "RangeTo" ]
268271#[ doc( alias = ".." ) ]
269- #[ derive( Copy , Clone , PartialEq , Eq , Hash ) ]
272+ #[ derive( Eq , Hash ) ]
273+ #[ derive_const( Copy , Clone , PartialEq ) ]
270274#[ stable( feature = "rust1" , since = "1.0.0" ) ]
271275pub struct RangeTo < Idx > {
272276 /// The upper bound of the range (exclusive).
@@ -340,7 +344,8 @@ impl<Idx: PartialOrd<Idx>> RangeTo<Idx> {
340344/// ```
341345#[ lang = "RangeInclusive" ]
342346#[ doc( alias = "..=" ) ]
343- #[ derive( Clone , PartialEq , Eq , Hash ) ] // not Copy -- see #27186
347+ #[ derive( Eq , Hash ) ]
348+ #[ derive_const( Clone , PartialEq ) ] // not Copy -- see #27186
344349#[ stable( feature = "inclusive_range" , since = "1.26.0" ) ]
345350pub struct RangeInclusive < Idx > {
346351 // Note that the fields here are not public to allow changing the
@@ -587,7 +592,8 @@ impl<Idx: PartialOrd<Idx>> RangeInclusive<Idx> {
587592/// [slicing index]: crate::slice::SliceIndex
588593#[ lang = "RangeToInclusive" ]
589594#[ doc( alias = "..=" ) ]
590- #[ derive( Copy , Clone , PartialEq , Eq , Hash ) ]
595+ #[ derive( Hash ) ]
596+ #[ derive_const( Copy , Clone , PartialEq , Eq ) ]
591597#[ stable( feature = "inclusive_range" , since = "1.26.0" ) ]
592598pub struct RangeToInclusive < Idx > {
593599 /// The upper bound of the range (inclusive)
@@ -668,7 +674,8 @@ impl<Idx: PartialOrd<Idx>> RangeToInclusive<Idx> {
668674///
669675/// [`BTreeMap::range`]: ../../std/collections/btree_map/struct.BTreeMap.html#method.range
670676#[ stable( feature = "collections_bound" , since = "1.17.0" ) ]
671- #[ derive( Clone , Copy , Debug , Hash , PartialEq , Eq ) ]
677+ #[ derive( Debug , Eq , Hash ) ]
678+ #[ derive_const( Clone , Copy , PartialEq ) ]
672679pub enum Bound < T > {
673680 /// An inclusive bound.
674681 #[ stable( feature = "collections_bound" , since = "1.17.0" ) ]
0 commit comments