@@ -20,7 +20,8 @@ unsafe_impl_trusted_step![char i8 i16 i32 i64 i128 isize u8 u16 u32 u64 u128 usi
20
20
/// The *successor* operation moves towards values that compare greater.
21
21
/// The *predecessor* operation moves towards values that compare lesser.
22
22
#[ unstable( feature = "step_trait" , reason = "recently redesigned" , issue = "42168" ) ]
23
- pub trait Step : Clone + PartialOrd + Sized {
23
+ #[ const_trait]
24
+ pub trait Step : ~const Clone + ~const PartialOrd + Sized {
24
25
/// Returns the number of *successor* steps required to get from `start` to `end`.
25
26
///
26
27
/// Returns `None` if the number of steps would overflow `usize`
@@ -234,7 +235,8 @@ macro_rules! step_integer_impls {
234
235
$(
235
236
#[ allow( unreachable_patterns) ]
236
237
#[ unstable( feature = "step_trait" , reason = "recently redesigned" , issue = "42168" ) ]
237
- impl Step for $u_narrower {
238
+ #[ rustc_const_unstable( feature = "const_iter" , issue = "92476" ) ]
239
+ impl const Step for $u_narrower {
238
240
step_identical_methods!( ) ;
239
241
240
242
#[ inline]
@@ -266,7 +268,8 @@ macro_rules! step_integer_impls {
266
268
267
269
#[ allow( unreachable_patterns) ]
268
270
#[ unstable( feature = "step_trait" , reason = "recently redesigned" , issue = "42168" ) ]
269
- impl Step for $i_narrower {
271
+ #[ rustc_const_unstable( feature = "const_iter" , issue = "92476" ) ]
272
+ impl const Step for $i_narrower {
270
273
step_identical_methods!( ) ;
271
274
272
275
#[ inline]
@@ -330,7 +333,8 @@ macro_rules! step_integer_impls {
330
333
$(
331
334
#[ allow( unreachable_patterns) ]
332
335
#[ unstable( feature = "step_trait" , reason = "recently redesigned" , issue = "42168" ) ]
333
- impl Step for $u_wider {
336
+ #[ rustc_const_unstable( feature = "const_iter" , issue = "92476" ) ]
337
+ impl const Step for $u_wider {
334
338
step_identical_methods!( ) ;
335
339
336
340
#[ inline]
@@ -355,7 +359,8 @@ macro_rules! step_integer_impls {
355
359
356
360
#[ allow( unreachable_patterns) ]
357
361
#[ unstable( feature = "step_trait" , reason = "recently redesigned" , issue = "42168" ) ]
358
- impl Step for $i_wider {
362
+ #[ rustc_const_unstable( feature = "const_iter" , issue = "92476" ) ]
363
+ impl const Step for $i_wider {
359
364
step_identical_methods!( ) ;
360
365
361
366
#[ inline]
@@ -405,7 +410,8 @@ step_integer_impls! {
405
410
}
406
411
407
412
#[ unstable( feature = "step_trait" , reason = "recently redesigned" , issue = "42168" ) ]
408
- impl Step for char {
413
+ #[ rustc_const_unstable( feature = "const_iter" , issue = "92476" ) ]
414
+ impl const Step for char {
409
415
#[ inline]
410
416
fn steps_between ( & start: & char , & end: & char ) -> Option < usize > {
411
417
let start = start as u32 ;
@@ -423,6 +429,7 @@ impl Step for char {
423
429
}
424
430
425
431
#[ inline]
432
+ #[ rustc_allow_const_fn_unstable( const_try) ]
426
433
fn forward_checked ( start : char , count : usize ) -> Option < char > {
427
434
let start = start as u32 ;
428
435
let mut res = Step :: forward_checked ( start, count) ?;
@@ -439,6 +446,7 @@ impl Step for char {
439
446
}
440
447
441
448
#[ inline]
449
+ #[ rustc_allow_const_fn_unstable( const_try) ]
442
450
fn backward_checked ( start : char , count : usize ) -> Option < char > {
443
451
let start = start as u32 ;
444
452
let mut res = Step :: backward_checked ( start, count) ?;
0 commit comments