@@ -24,12 +24,15 @@ mod iter;
2424#[ unstable( feature = "new_range_api" , issue = "125687" ) ]
2525pub mod legacy;
2626
27+ #[ doc( inline) ]
28+ #[ stable( feature = "new_range_from_api" , since = "CURRENT_RUSTC_VERSION" ) ]
29+ pub use iter:: RangeFromIter ;
2730#[ doc( inline) ]
2831#[ stable( feature = "new_range_inclusive_api" , since = "1.95.0" ) ]
2932pub use iter:: RangeInclusiveIter ;
3033#[ doc( inline) ]
3134#[ unstable( feature = "new_range_api" , issue = "125687" ) ]
32- pub use iter:: { RangeFromIter , RangeIter } ;
35+ pub use iter:: RangeIter ;
3336
3437// FIXME(#125687): re-exports temporarily removed
3538// Because re-exports of stable items (Bound, RangeBounds, RangeFull, RangeTo)
@@ -416,14 +419,13 @@ impl<T> const From<legacy::RangeInclusive<T>> for RangeInclusive<T> {
416419///
417420/// The `RangeFrom` `start..` contains all values with `x >= start`.
418421///
419- /// *Note*: Overflow in the [`Iterator `] implementation (when the contained
422+ /// *Note*: Overflow in the [`IntoIterator `] implementation (when the contained
420423/// data type reaches its numerical limit) is allowed to panic, wrap, or
421424/// saturate. This behavior is defined by the implementation of the [`Step`]
422425/// trait. For primitive integers, this follows the normal rules, and respects
423- /// the overflow checks profile (panic in debug, wrap in release). Note also
424- /// that overflow happens earlier than you might assume: the overflow happens
425- /// in the call to `next` that yields the maximum value, as the range must be
426- /// set to a state to yield the next value.
426+ /// the overflow checks profile (panic in debug, wrap in release). Unlike
427+ /// its legacy counterpart, the iterator will only panic after yielding the
428+ /// maximum value when overflow checks are enabled.
427429///
428430/// [`Step`]: crate::iter::Step
429431///
@@ -432,7 +434,6 @@ impl<T> const From<legacy::RangeInclusive<T>> for RangeInclusive<T> {
432434/// The `start..` syntax is a `RangeFrom`:
433435///
434436/// ```
435- /// #![feature(new_range_api)]
436437/// use core::range::RangeFrom;
437438///
438439/// assert_eq!(RangeFrom::from(2..), core::range::RangeFrom { start: 2 });
@@ -441,14 +442,14 @@ impl<T> const From<legacy::RangeInclusive<T>> for RangeInclusive<T> {
441442#[ lang = "RangeFromCopy" ]
442443#[ derive( Copy , Hash ) ]
443444#[ derive_const( Clone , PartialEq , Eq ) ]
444- #[ unstable ( feature = "new_range_api " , issue = "125687 " ) ]
445+ #[ stable ( feature = "new_range_from_api " , since = "CURRENT_RUSTC_VERSION " ) ]
445446pub struct RangeFrom < Idx > {
446447 /// The lower bound of the range (inclusive).
447- #[ unstable ( feature = "new_range_api " , issue = "125687 " ) ]
448+ #[ stable ( feature = "new_range_from_api " , since = "CURRENT_RUSTC_VERSION " ) ]
448449 pub start : Idx ,
449450}
450451
451- #[ unstable ( feature = "new_range_api " , issue = "125687 " ) ]
452+ #[ stable ( feature = "new_range_from_api " , since = "CURRENT_RUSTC_VERSION " ) ]
452453impl < Idx : fmt:: Debug > fmt:: Debug for RangeFrom < Idx > {
453454 fn fmt ( & self , fmt : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
454455 self . start . fmt ( fmt) ?;
@@ -465,15 +466,14 @@ impl<Idx: Step> RangeFrom<Idx> {
465466 /// # Examples
466467 ///
467468 /// ```
468- /// #![feature(new_range_api)]
469469 /// use core::range::RangeFrom;
470470 ///
471471 /// let mut i = RangeFrom::from(3..).iter().map(|n| n*n);
472472 /// assert_eq!(i.next(), Some(9));
473473 /// assert_eq!(i.next(), Some(16));
474474 /// assert_eq!(i.next(), Some(25));
475475 /// ```
476- #[ unstable ( feature = "new_range_api " , issue = "125687 " ) ]
476+ #[ stable ( feature = "new_range_from_api " , since = "CURRENT_RUSTC_VERSION " ) ]
477477 #[ inline]
478478 pub fn iter ( & self ) -> RangeFromIter < Idx > {
479479 self . clone ( ) . into_iter ( )
@@ -486,7 +486,6 @@ impl<Idx: PartialOrd<Idx>> RangeFrom<Idx> {
486486 /// # Examples
487487 ///
488488 /// ```
489- /// #![feature(new_range_api)]
490489 /// use core::range::RangeFrom;
491490 ///
492491 /// assert!(!RangeFrom::from(3..).contains(&2));
@@ -498,7 +497,7 @@ impl<Idx: PartialOrd<Idx>> RangeFrom<Idx> {
498497 /// assert!(!RangeFrom::from(f32::NAN..).contains(&0.5));
499498 /// ```
500499 #[ inline]
501- #[ unstable ( feature = "new_range_api " , issue = "125687 " ) ]
500+ #[ stable ( feature = "new_range_from_api " , since = "CURRENT_RUSTC_VERSION " ) ]
502501 #[ rustc_const_unstable( feature = "const_range" , issue = "none" ) ]
503502 pub const fn contains < U > ( & self , item : & U ) -> bool
504503 where
@@ -509,7 +508,7 @@ impl<Idx: PartialOrd<Idx>> RangeFrom<Idx> {
509508 }
510509}
511510
512- #[ unstable ( feature = "new_range_api " , issue = "125687 " ) ]
511+ #[ stable ( feature = "new_range_from_api " , since = "CURRENT_RUSTC_VERSION " ) ]
513512#[ rustc_const_unstable( feature = "const_range" , issue = "none" ) ]
514513impl < T > const RangeBounds < T > for RangeFrom < T > {
515514 fn start_bound ( & self ) -> Bound < & T > {
@@ -526,7 +525,7 @@ impl<T> const RangeBounds<T> for RangeFrom<T> {
526525/// If you need to use this implementation where `T` is unsized,
527526/// consider using the `RangeBounds` impl for a 2-tuple of [`Bound<&T>`][Bound],
528527/// i.e. replace `start..` with `(Bound::Included(start), Bound::Unbounded)`.
529- #[ unstable ( feature = "new_range_api " , issue = "125687 " ) ]
528+ #[ stable ( feature = "new_range_from_api " , since = "CURRENT_RUSTC_VERSION " ) ]
530529#[ rustc_const_unstable( feature = "const_range" , issue = "none" ) ]
531530impl < T > const RangeBounds < T > for RangeFrom < & T > {
532531 fn start_bound ( & self ) -> Bound < & T > {
@@ -537,8 +536,7 @@ impl<T> const RangeBounds<T> for RangeFrom<&T> {
537536 }
538537}
539538
540- // #[unstable(feature = "range_into_bounds", issue = "136903")]
541- #[ unstable( feature = "new_range_api" , issue = "125687" ) ]
539+ #[ unstable( feature = "range_into_bounds" , issue = "136903" ) ]
542540#[ rustc_const_unstable( feature = "const_range" , issue = "none" ) ]
543541impl < T > const IntoBounds < T > for RangeFrom < T > {
544542 fn into_bounds ( self ) -> ( Bound < T > , Bound < T > ) {
@@ -547,7 +545,6 @@ impl<T> const IntoBounds<T> for RangeFrom<T> {
547545}
548546
549547#[ unstable( feature = "one_sided_range" , issue = "69780" ) ]
550- // #[unstable(feature = "new_range_api", issue = "125687")]
551548#[ rustc_const_unstable( feature = "const_range" , issue = "none" ) ]
552549impl < T > const OneSidedRange < T > for RangeFrom < T >
553550where
@@ -558,15 +555,15 @@ where
558555 }
559556}
560557
561- #[ unstable ( feature = "new_range_api " , issue = "125687 " ) ]
558+ #[ stable ( feature = "new_range_from_api " , since = "CURRENT_RUSTC_VERSION " ) ]
562559#[ rustc_const_unstable( feature = "const_index" , issue = "143775" ) ]
563560impl < T > const From < RangeFrom < T > > for legacy:: RangeFrom < T > {
564561 #[ inline]
565562 fn from ( value : RangeFrom < T > ) -> Self {
566563 Self { start : value. start }
567564 }
568565}
569- #[ unstable ( feature = "new_range_api " , issue = "125687 " ) ]
566+ #[ stable ( feature = "new_range_from_api " , since = "CURRENT_RUSTC_VERSION " ) ]
570567#[ rustc_const_unstable( feature = "const_index" , issue = "143775" ) ]
571568impl < T > const From < legacy:: RangeFrom < T > > for RangeFrom < T > {
572569 #[ inline]
@@ -697,7 +694,6 @@ impl<T> const RangeBounds<T> for RangeToInclusive<&T> {
697694 }
698695}
699696
700- // #[stable(feature = "new_range_to_inclusive_api", since = "CURRENT_RUSTC_VERSION")]
701697#[ unstable( feature = "range_into_bounds" , issue = "136903" ) ]
702698#[ rustc_const_unstable( feature = "const_range" , issue = "none" ) ]
703699impl < T > const IntoBounds < T > for RangeToInclusive < T > {
@@ -706,7 +702,6 @@ impl<T> const IntoBounds<T> for RangeToInclusive<T> {
706702 }
707703}
708704
709- // #[stable(feature = "new_range_to_inclusive_api", since = "CURRENT_RUSTC_VERSION")]
710705#[ unstable( feature = "one_sided_range" , issue = "69780" ) ]
711706#[ rustc_const_unstable( feature = "const_range" , issue = "none" ) ]
712707impl < T > const OneSidedRange < T > for RangeToInclusive < T >
0 commit comments