Skip to content

Commit

Permalink
Deprecate iter::range::StepBy
Browse files Browse the repository at this point in the history
Only exposed as DeprecatedStepBy (as of PR 41439)
  • Loading branch information
scottmcm committed Jun 1, 2017
1 parent 0967e24 commit 1723e06
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/libcore/iter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,9 @@ pub use self::iterator::Iterator;
pub use self::range::Step;
#[unstable(feature = "step_by", reason = "recent addition",
issue = "27741")]
#[rustc_deprecated(since = "1.19.0",
reason = "replaced by `iter::StepBy`")]
#[allow(deprecated)]
pub use self::range::StepBy as DeprecatedStepBy;

#[stable(feature = "rust1", since = "1.0.0")]
Expand Down
12 changes: 12 additions & 0 deletions src/libcore/iter/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@ step_impl_no_between!(u128 i128);
#[derive(Clone, Debug)]
#[unstable(feature = "step_by", reason = "recent addition",
issue = "27741")]
#[rustc_deprecated(since = "1.19.0",
reason = "replaced by `iter::StepBy`")]
#[allow(deprecated)]
pub struct StepBy<A, R> {
step_by: A,
range: R,
Expand All @@ -274,6 +277,7 @@ impl<A: Step> ops::RangeFrom<A> {
issue = "27741")]
#[rustc_deprecated(since = "1.19.0",
reason = "replaced by `Iterator::step_by`")]
#[allow(deprecated)]
pub fn step_by(self, by: A) -> StepBy<A, Self> {
StepBy {
step_by: by,
Expand Down Expand Up @@ -301,6 +305,7 @@ impl<A: Step> ops::Range<A> {
issue = "27741")]
#[rustc_deprecated(since = "1.19.0",
reason = "replaced by `Iterator::step_by`")]
#[allow(deprecated)]
pub fn step_by(self, by: A) -> StepBy<A, Self> {
StepBy {
step_by: by,
Expand All @@ -327,6 +332,7 @@ impl<A: Step> ops::RangeInclusive<A> {
issue = "27741")]
#[rustc_deprecated(since = "1.19.0",
reason = "replaced by `Iterator::step_by`")]
#[allow(deprecated)]
pub fn step_by(self, by: A) -> StepBy<A, Self> {
StepBy {
step_by: by,
Expand All @@ -337,6 +343,7 @@ impl<A: Step> ops::RangeInclusive<A> {

#[unstable(feature = "step_by", reason = "recent addition",
issue = "27741")]
#[allow(deprecated)]
impl<A> Iterator for StepBy<A, ops::RangeFrom<A>> where
A: Clone,
for<'a> &'a A: Add<&'a A, Output = A>
Expand All @@ -357,11 +364,13 @@ impl<A> Iterator for StepBy<A, ops::RangeFrom<A>> where
}

#[unstable(feature = "fused", issue = "35602")]
#[allow(deprecated)]
impl<A> FusedIterator for StepBy<A, ops::RangeFrom<A>>
where A: Clone, for<'a> &'a A: Add<&'a A, Output = A> {}

#[unstable(feature = "step_by", reason = "recent addition",
issue = "27741")]
#[allow(deprecated)]
impl<A: Step + Clone> Iterator for StepBy<A, ops::Range<A>> {
type Item = A;

Expand Down Expand Up @@ -399,11 +408,13 @@ impl<A: Step + Clone> Iterator for StepBy<A, ops::Range<A>> {
}

#[unstable(feature = "fused", issue = "35602")]
#[allow(deprecated)]
impl<A: Step + Clone> FusedIterator for StepBy<A, ops::Range<A>> {}

#[unstable(feature = "inclusive_range",
reason = "recently added, follows RFC",
issue = "28237")]
#[allow(deprecated)]
impl<A: Step + Clone> Iterator for StepBy<A, ops::RangeInclusive<A>> {
type Item = A;

Expand Down Expand Up @@ -443,6 +454,7 @@ impl<A: Step + Clone> Iterator for StepBy<A, ops::RangeInclusive<A>> {
}

#[unstable(feature = "fused", issue = "35602")]
#[allow(deprecated)]
impl<A: Step + Clone> FusedIterator for StepBy<A, ops::RangeInclusive<A>> {}

macro_rules! range_exact_iter_impl {
Expand Down

0 comments on commit 1723e06

Please sign in to comment.