@@ -71,7 +71,8 @@ impl fmt::Debug for RangeFull {
71
71
/// ```
72
72
#[ lang = "Range" ]
73
73
#[ doc( alias = ".." ) ]
74
- #[ derive( Clone , Default , PartialEq , Eq , Hash ) ] // not Copy -- see #27186
74
+ #[ derive( Clone , Default , PartialEq , Eq , Hash ) ]
75
+ #[ cfg_attr( not( bootstrap) , derive( Copy ) ) ]
75
76
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
76
77
pub struct Range < Idx > {
77
78
/// The lower bound of the range (inclusive).
@@ -82,6 +83,10 @@ pub struct Range<Idx> {
82
83
pub end : Idx ,
83
84
}
84
85
86
+ #[ unstable( feature = "must_clone" , issue = "none" ) ]
87
+ #[ cfg( not( bootstrap) ) ]
88
+ impl < Idx : Copy > crate :: marker:: MustClone for Range < Idx > { }
89
+
85
90
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
86
91
impl < Idx : fmt:: Debug > fmt:: Debug for Range < Idx > {
87
92
fn fmt ( & self , fmt : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
@@ -174,14 +179,19 @@ impl<Idx: PartialOrd<Idx>> Range<Idx> {
174
179
/// ```
175
180
#[ lang = "RangeFrom" ]
176
181
#[ doc( alias = ".." ) ]
177
- #[ derive( Clone , PartialEq , Eq , Hash ) ] // not Copy -- see #27186
182
+ #[ derive( Clone , PartialEq , Eq , Hash ) ]
183
+ #[ cfg_attr( not( bootstrap) , derive( Copy ) ) ]
178
184
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
179
185
pub struct RangeFrom < Idx > {
180
186
/// The lower bound of the range (inclusive).
181
187
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
182
188
pub start : Idx ,
183
189
}
184
190
191
+ #[ unstable( feature = "must_clone" , issue = "none" ) ]
192
+ #[ cfg( not( bootstrap) ) ]
193
+ impl < Idx : Copy > crate :: marker:: MustClone for RangeFrom < Idx > { }
194
+
185
195
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
186
196
impl < Idx : fmt:: Debug > fmt:: Debug for RangeFrom < Idx > {
187
197
fn fmt ( & self , fmt : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
@@ -324,7 +334,8 @@ impl<Idx: PartialOrd<Idx>> RangeTo<Idx> {
324
334
/// ```
325
335
#[ lang = "RangeInclusive" ]
326
336
#[ doc( alias = "..=" ) ]
327
- #[ derive( Clone , PartialEq , Eq , Hash ) ] // not Copy -- see #27186
337
+ #[ derive( Clone , PartialEq , Eq , Hash ) ]
338
+ #[ cfg_attr( not( bootstrap) , derive( Copy ) ) ]
328
339
#[ stable( feature = "inclusive_range" , since = "1.26.0" ) ]
329
340
pub struct RangeInclusive < Idx > {
330
341
// Note that the fields here are not public to allow changing the
@@ -344,6 +355,10 @@ pub struct RangeInclusive<Idx> {
344
355
pub ( crate ) exhausted : bool ,
345
356
}
346
357
358
+ #[ unstable( feature = "must_clone" , issue = "none" ) ]
359
+ #[ cfg( not( bootstrap) ) ]
360
+ impl < Idx : Copy > crate :: marker:: MustClone for RangeInclusive < Idx > { }
361
+
347
362
impl < Idx > RangeInclusive < Idx > {
348
363
/// Creates a new inclusive range. Equivalent to writing `start..=end`.
349
364
///
0 commit comments