@@ -21,7 +21,8 @@ unsafe_impl_trusted_step![char i8 i16 i32 i64 i128 isize u8 u16 u32 u64 u128 usi
2121/// The *successor* operation moves towards values that compare greater.
2222/// The *predecessor* operation moves towards values that compare lesser.
2323#[ 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 {
2526 /// Returns the number of *successor* steps required to get from `start` to `end`.
2627 ///
2728 /// Returns `None` if the number of steps would overflow `usize`
@@ -235,7 +236,8 @@ macro_rules! step_integer_impls {
235236 $(
236237 #[ allow( unreachable_patterns) ]
237238 #[ 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 {
239241 step_identical_methods!( ) ;
240242
241243 #[ inline]
@@ -267,7 +269,8 @@ macro_rules! step_integer_impls {
267269
268270 #[ allow( unreachable_patterns) ]
269271 #[ 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 {
271274 step_identical_methods!( ) ;
272275
273276 #[ inline]
@@ -331,7 +334,8 @@ macro_rules! step_integer_impls {
331334 $(
332335 #[ allow( unreachable_patterns) ]
333336 #[ 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 {
335339 step_identical_methods!( ) ;
336340
337341 #[ inline]
@@ -356,7 +360,8 @@ macro_rules! step_integer_impls {
356360
357361 #[ allow( unreachable_patterns) ]
358362 #[ 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 {
360365 step_identical_methods!( ) ;
361366
362367 #[ inline]
@@ -406,7 +411,8 @@ step_integer_impls! {
406411}
407412
408413#[ 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 {
410416 #[ inline]
411417 fn steps_between ( & start: & char , & end: & char ) -> Option < usize > {
412418 let start = start as u32 ;
@@ -424,6 +430,7 @@ impl Step for char {
424430 }
425431
426432 #[ inline]
433+ #[ rustc_allow_const_fn_unstable( const_try) ]
427434 fn forward_checked ( start : char , count : usize ) -> Option < char > {
428435 let start = start as u32 ;
429436 let mut res = Step :: forward_checked ( start, count) ?;
@@ -440,6 +447,7 @@ impl Step for char {
440447 }
441448
442449 #[ inline]
450+ #[ rustc_allow_const_fn_unstable( const_try) ]
443451 fn backward_checked ( start : char , count : usize ) -> Option < char > {
444452 let start = start as u32 ;
445453 let mut res = Step :: backward_checked ( start, count) ?;
0 commit comments