Skip to content

Commit 0bb3fe3

Browse files
committed
core: Move {RangeIter, RangeFromIter}::remainder to new_range_remainder
Split the remainder functions from the rest of `std::range`.
1 parent cbc9434 commit 0bb3fe3

6 files changed

Lines changed: 15 additions & 9 deletions

File tree

library/core/src/range/iter.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,15 @@ use crate::{intrinsics, mem};
1111
pub struct RangeIter<A>(legacy::Range<A>);
1212

1313
impl<A> RangeIter<A> {
14-
#[unstable(feature = "new_range_api", issue = "125687")]
14+
#[unstable(feature = "new_range_remainder", issue = "154458")]
1515
/// Returns the remainder of the range being iterated over.
1616
///
1717
/// # Examples
18+
///
1819
/// ```
1920
/// #![feature(new_range_api)]
21+
/// #![feature(new_range_remainder)]
22+
///
2023
/// let range = core::range::Range::from(3..11);
2124
/// let mut iter = range.into_iter();
2225
/// assert_eq!(iter.clone().remainder(), range);
@@ -333,8 +336,10 @@ impl<A: Step> RangeFromIter<A> {
333336
/// Returns the remainder of the range being iterated over.
334337
///
335338
/// # Examples
339+
///
336340
/// ```
337-
/// #![feature(new_range_api)]
341+
/// #![feature(new_range_remainder)]
342+
///
338343
/// let range = core::range::RangeFrom::from(3..);
339344
/// let mut iter = range.into_iter();
340345
/// assert_eq!(iter.clone().remainder(), range);
@@ -343,7 +348,7 @@ impl<A: Step> RangeFromIter<A> {
343348
/// ```
344349
#[inline]
345350
#[rustc_inherit_overflow_checks]
346-
#[unstable(feature = "new_range_api", issue = "125687")]
351+
#[unstable(feature = "new_range_remainder", issue = "154458")]
347352
pub fn remainder(self) -> RangeFrom<A> {
348353
// Need to handle this case even if overflow-checks are disabled,
349354
// because a `RangeFromIter` could be exhausted in a crate with

tests/codegen-llvm/fromrangeiter-overflow-checks.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
#![crate_type = "lib"]
1313
#![feature(new_range_api)]
14+
#![feature(new_range_remainder)]
1415

1516
use std::range::RangeFrom;
1617

tests/ui/iterators/rangefrom-overflow-debug.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//@ needs-unwind
33
//@ compile-flags: -O -C debug_assertions=yes
44

5-
#![feature(new_range_api)]
5+
#![feature(new_range_remainder)]
66

77
use std::panic;
88

tests/ui/iterators/rangefrom-overflow-ndebug.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//@ run-pass
22
//@ compile-flags: -O -C debug_assertions=no
33

4-
#![feature(new_range_api)]
4+
#![feature(new_range_remainder)]
55

66
fn main() {
77
let mut it = core::range::RangeFrom::from(u8::MAX..).into_iter();

tests/ui/iterators/rangefrom-overflow-overflow-checks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//@ needs-unwind
33
//@ compile-flags: -O -C overflow-checks=yes
44

5-
#![feature(new_range_api)]
5+
#![feature(new_range_remainder)]
66

77
use std::panic;
88

tests/ui/range/new_range_stability.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ LL | i.remainder();
3838
= help: add `#![feature(new_range_remainder)]` to the crate attributes to enable
3939
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
4040

41-
error[E0658]: use of unstable library feature `new_range_api`
41+
error[E0658]: use of unstable library feature `new_range_remainder`
4242
--> $DIR/new_range_stability.rs:43:7
4343
|
4444
LL | i.remainder();
4545
| ^^^^^^^^^
4646
|
47-
= note: see issue #125687 <https://github.com/rust-lang/rust/issues/125687> for more information
48-
= help: add `#![feature(new_range_api)]` to the crate attributes to enable
47+
= note: see issue #154458 <https://github.com/rust-lang/rust/issues/154458> for more information
48+
= help: add `#![feature(new_range_remainder)]` to the crate attributes to enable
4949
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
5050

5151
error: aborting due to 5 previous errors

0 commit comments

Comments
 (0)