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