Skip to content

Commit e8de245

Browse files
committed
Make IndexRange accessible from alloc
Specifically make it public + unstable under `std_internals` + `doc(hidden)`. This is honestly Not Great, but I do not know a better solution :(
1 parent 96e51d9 commit e8de245

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

library/core/src/ops/index_range.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![unstable(feature = "std_internals", issue = "none")]
2+
#![doc(hidden)]
13
use crate::iter::{FusedIterator, TrustedLen};
24
use crate::num::NonZero;
35
use crate::ub_checks;
@@ -9,7 +11,7 @@ use crate::ub_checks;
911
/// (Normal `Range` code needs to handle degenerate ranges like `10..0`,
1012
/// which takes extra checks compared to only handling the canonical form.)
1113
#[derive(Clone, Debug, PartialEq, Eq)]
12-
pub(crate) struct IndexRange {
14+
pub struct IndexRange {
1315
start: usize,
1416
end: usize,
1517
}

library/core/src/ops/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,9 @@ pub(crate) use self::drop::fallback_surface_drop;
181181
pub use self::function::{Fn, FnMut, FnOnce};
182182
#[stable(feature = "rust1", since = "1.0.0")]
183183
pub use self::index::{Index, IndexMut};
184-
pub(crate) use self::index_range::IndexRange;
184+
#[doc(hidden)]
185+
#[unstable(feature = "std_internals", issue = "none")]
186+
pub use self::index_range::IndexRange;
185187
#[unstable(feature = "one_sided_range", issue = "69780")]
186188
pub use self::range::OneSidedRange;
187189
#[stable(feature = "inclusive_range", since = "1.26.0")]

library/core/src/slice/index.rs

+4
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ mod private_slice_index {
149149
#[unstable(feature = "new_range_api", issue = "125687")]
150150
impl Sealed for range::RangeFrom<usize> {}
151151

152+
#[doc(hidden)]
153+
#[unstable(feature = "std_internals", issue = "none")]
152154
impl Sealed for ops::IndexRange {}
153155
}
154156

@@ -283,6 +285,8 @@ unsafe impl<T> SliceIndex<[T]> for usize {
283285

284286
/// Because `IndexRange` guarantees `start <= end`, fewer checks are needed here
285287
/// than there are for a general `Range<usize>` (which might be `100..3`).
288+
#[doc(hidden)]
289+
#[unstable(feature = "std_internals", issue = "none")]
286290
unsafe impl<T> SliceIndex<[T]> for ops::IndexRange {
287291
type Output = [T];
288292

0 commit comments

Comments
 (0)