Skip to content

Commit 35ce368

Browse files
committed
Unify feature flags as step_trait
While stdlib implementations of the unchecked methods require unchecked math, there is no reason to gate it behind this for external users. The reasoning for a separate `step_trait_ext` feature is unclear, and as such has been merged as well.
1 parent bc2f0fb commit 35ce368

File tree

4 files changed

+1
-9
lines changed

4 files changed

+1
-9
lines changed

compiler/rustc_index/src/vec.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ impl Idx for u32 {
6565
/// `u32::MAX`. You can also customize things like the `Debug` impl,
6666
/// what traits are derived, and so forth via the macro.
6767
#[macro_export]
68-
#[allow_internal_unstable(step_trait, step_trait_ext, rustc_attrs)]
68+
#[allow_internal_unstable(step_trait, rustc_attrs)]
6969
macro_rules! newtype_index {
7070
// ---- public rules ----
7171

library/core/src/iter/range.rs

-6
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ pub trait Step: Clone + PartialOrd + Sized {
5757
///
5858
/// * `Step::forward_checked(a, n) == (0..n).try_fold(a, |x, _| Step::forward_checked(&x, 1))`
5959
/// * Corollary: `Step::forward_checked(&a, 0) == Some(a)`
60-
#[unstable(feature = "step_trait_ext", reason = "recently added", issue = "42168")]
6160
fn forward_checked(start: Self, count: usize) -> Option<Self>;
6261

6362
/// Returns the value that would be obtained by taking the *successor*
@@ -83,7 +82,6 @@ pub trait Step: Clone + PartialOrd + Sized {
8382
/// * Corollary: `Step::forward(a, 0) == a`
8483
/// * `Step::forward(a, n) >= a`
8584
/// * `Step::backward(Step::forward(a, n), n) == a`
86-
#[unstable(feature = "step_trait_ext", reason = "recently added", issue = "42168")]
8785
fn forward(start: Self, count: usize) -> Self {
8886
Step::forward_checked(start, count).expect("overflow in `Step::forward`")
8987
}
@@ -108,7 +106,6 @@ pub trait Step: Clone + PartialOrd + Sized {
108106
/// For any `a` and `n`, where no overflow occurs:
109107
///
110108
/// * `Step::forward_unchecked(a, n)` is equivalent to `Step::forward(a, n)`
111-
#[unstable(feature = "step_trait_ext", reason = "recently added", issue = "42168")]
112109
unsafe fn forward_unchecked(start: Self, count: usize) -> Self {
113110
Step::forward(start, count)
114111
}
@@ -129,7 +126,6 @@ pub trait Step: Clone + PartialOrd + Sized {
129126
///
130127
/// * `Step::backward_checked(a, n) == (0..n).try_fold(a, |x, _| Step::backward_checked(&x, 1))`
131128
/// * Corollary: `Step::backward_checked(&a, 0) == Some(a)`
132-
#[unstable(feature = "step_trait_ext", reason = "recently added", issue = "42168")]
133129
fn backward_checked(start: Self, count: usize) -> Option<Self>;
134130

135131
/// Returns the value that would be obtained by taking the *predecessor*
@@ -155,7 +151,6 @@ pub trait Step: Clone + PartialOrd + Sized {
155151
/// * Corollary: `Step::backward(a, 0) == a`
156152
/// * `Step::backward(a, n) <= a`
157153
/// * `Step::forward(Step::backward(a, n), n) == a`
158-
#[unstable(feature = "step_trait_ext", reason = "recently added", issue = "42168")]
159154
fn backward(start: Self, count: usize) -> Self {
160155
Step::backward_checked(start, count).expect("overflow in `Step::backward`")
161156
}
@@ -180,7 +175,6 @@ pub trait Step: Clone + PartialOrd + Sized {
180175
/// For any `a` and `n`, where no overflow occurs:
181176
///
182177
/// * `Step::backward_unchecked(a, n)` is equivalent to `Step::backward(a, n)`
183-
#[unstable(feature = "step_trait_ext", reason = "recently added", issue = "42168")]
184178
unsafe fn backward_unchecked(start: Self, count: usize) -> Self {
185179
Step::backward(start, count)
186180
}

library/core/tests/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
#![feature(maybe_uninit_write_slice)]
4141
#![feature(min_specialization)]
4242
#![feature(step_trait)]
43-
#![feature(step_trait_ext)]
4443
#![feature(str_internals)]
4544
#![feature(test)]
4645
#![feature(trusted_len)]

src/test/ui/impl-trait/example-calendar.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
#![feature(fn_traits,
55
step_trait,
6-
step_trait_ext,
76
unboxed_closures,
87
)]
98

0 commit comments

Comments
 (0)