diff --git a/library/core/src/range.rs b/library/core/src/range.rs index ade9a35b0ab33..6ca05f2f57e5c 100644 --- a/library/core/src/range.rs +++ b/library/core/src/range.rs @@ -20,9 +20,11 @@ use crate::hash::Hash; mod iter; -#[unstable(feature = "new_range_api_legacy", issue = "125687")] +#[stable(feature = "new_range_api_legacy", since = "CURRENT_RUSTC_VERSION")] pub mod legacy; +use core::ops::Bound::{self, Excluded, Included, Unbounded}; + #[doc(inline)] #[stable(feature = "new_range_from_api", since = "1.96.0")] pub use iter::RangeFromIter; @@ -33,19 +35,13 @@ pub use iter::RangeInclusiveIter; #[stable(feature = "new_range_api", since = "1.96.0")] pub use iter::RangeIter; -// FIXME(#125687): re-exports temporarily removed -// Because re-exports of stable items (Bound, RangeBounds, RangeFull, RangeTo) -// can't be made unstable. -// -// #[doc(inline)] -// #[unstable(feature = "new_range_api", issue = "125687")] -// pub use crate::iter::Step; -// #[doc(inline)] -// #[unstable(feature = "new_range_api", issue = "125687")] -// pub use crate::ops::{Bound, IntoBounds, OneSidedRange, RangeBounds, RangeFull, RangeTo}; use crate::iter::Step; -use crate::ops::Bound::{self, Excluded, Included, Unbounded}; +// FIXME(one_sided_range): These types should move into this module. +// FIXME(range_into_bounds): Ditto. Also consider re-exporting `RangeBounds` and related. use crate::ops::{IntoBounds, OneSidedRange, OneSidedRangeBound, RangeBounds}; +#[doc(inline)] +#[stable(feature = "new_range_api_exports", since = "CURRENT_RUSTC_VERSION")] +pub use crate::ops::{RangeFull, RangeTo}; /// A (half-open) range bounded inclusively below and exclusively above. /// diff --git a/library/core/src/range/legacy.rs b/library/core/src/range/legacy.rs index aa11331382dd0..03f024354479d 100644 --- a/library/core/src/range/legacy.rs +++ b/library/core/src/range/legacy.rs @@ -7,4 +7,5 @@ //! The types here are equivalent to those in [`core::ops`]. #[doc(inline)] +#[stable(feature = "new_range_api_legacy", since = "CURRENT_RUSTC_VERSION")] pub use crate::ops::{Range, RangeFrom, RangeInclusive, RangeToInclusive}; diff --git a/tests/ui/new-range/disabled.rs b/tests/ui/new-range/disabled.rs index 528c464117a13..25e35614c66a8 100644 --- a/tests/ui/new-range/disabled.rs +++ b/tests/ui/new-range/disabled.rs @@ -1,15 +1,13 @@ +//! Without the `new_range` feature enabled, `..` syntax resolves to the legacy types. //@ check-pass -#![feature(new_range_api_legacy)] - fn main() { // Unchanged let a: core::ops::RangeFull = ..; let b: core::ops::RangeTo = ..2; - // FIXME(#125687): re-exports temporarily removed - // let _: core::range::RangeFull = a; - // let _: core::range::RangeTo = b; + let _: core::range::RangeFull = a; + let _: core::range::RangeTo = b; // Changed let a: core::range::legacy::RangeFrom = 1..; diff --git a/tests/ui/new-range/enabled.rs b/tests/ui/new-range/enabled.rs index 6d9a1259b7756..ed227e088fcfa 100644 --- a/tests/ui/new-range/enabled.rs +++ b/tests/ui/new-range/enabled.rs @@ -1,3 +1,4 @@ +//! With the `new_range` feature enabled, `..` syntax resolves to the new range types. //@ check-pass #![feature(new_range)] @@ -7,9 +8,8 @@ fn main() { let a: core::ops::RangeFull = ..; let b: core::ops::RangeTo = ..2; - // FIXME(#125687): re-exports temporarily removed - // let _: core::range::RangeFull = a; - // let _: core::range::RangeTo = b; + let _: core::range::RangeFull = a; + let _: core::range::RangeTo = b; // Changed let a: core::range::RangeFrom = 1..; diff --git a/tests/ui/range/new_range_stability.rs b/tests/ui/range/new_range_stability.rs index 965be17efa747..cea1b33aac467 100644 --- a/tests/ui/range/new_range_stability.rs +++ b/tests/ui/range/new_range_stability.rs @@ -7,6 +7,7 @@ use std::range::{ RangeFrom, RangeFromIter, Range, + legacy, }; fn range_inclusive(mut r: RangeInclusive) { @@ -60,8 +61,4 @@ fn range(mut r: Range) { i.remainder(); //~ ERROR unstable } -// Unstable module - -use std::range::legacy; //~ ERROR unstable - fn main() {} diff --git a/tests/ui/range/new_range_stability.stderr b/tests/ui/range/new_range_stability.stderr index ac269a2b2227e..f280d15de1065 100644 --- a/tests/ui/range/new_range_stability.stderr +++ b/tests/ui/range/new_range_stability.stderr @@ -1,15 +1,5 @@ -error[E0658]: use of unstable library feature `new_range_api_legacy` - --> $DIR/new_range_stability.rs:65:5 - | -LL | use std::range::legacy; - | ^^^^^^^^^^^^^^^^^^ - | - = note: see issue #125687 for more information - = help: add `#![feature(new_range_api_legacy)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - error[E0658]: use of unstable library feature `new_range_remainder` - --> $DIR/new_range_stability.rs:23:7 + --> $DIR/new_range_stability.rs:24:7 | LL | i.remainder(); | ^^^^^^^^^ @@ -19,7 +9,7 @@ LL | i.remainder(); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: use of unstable library feature `new_range_remainder` - --> $DIR/new_range_stability.rs:44:7 + --> $DIR/new_range_stability.rs:45:7 | LL | i.remainder(); | ^^^^^^^^^ @@ -29,7 +19,7 @@ LL | i.remainder(); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: use of unstable library feature `new_range_remainder` - --> $DIR/new_range_stability.rs:60:7 + --> $DIR/new_range_stability.rs:61:7 | LL | i.remainder(); | ^^^^^^^^^ @@ -38,6 +28,6 @@ LL | i.remainder(); = help: add `#![feature(new_range_remainder)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0658`.