Skip to content

Commit ecd3bb0

Browse files
committed
Stabilize substr_range and related methods
1 parent 60dabef commit ecd3bb0

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

library/core/src/slice/mod.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4738,8 +4738,6 @@ impl<T> [T] {
47384738
/// # Examples
47394739
/// Basic usage:
47404740
/// ```
4741-
/// #![feature(substr_range)]
4742-
///
47434741
/// let nums: &[u32] = &[1, 7, 1, 1];
47444742
/// let num = &nums[2];
47454743
///
@@ -4748,8 +4746,6 @@ impl<T> [T] {
47484746
/// ```
47494747
/// Returning `None` with an unaligned element:
47504748
/// ```
4751-
/// #![feature(substr_range)]
4752-
///
47534749
/// let arr: &[[u32; 2]] = &[[0, 1], [2, 3]];
47544750
/// let flat_arr: &[u32] = arr.as_flattened();
47554751
///
@@ -4763,7 +4759,7 @@ impl<T> [T] {
47634759
/// assert_eq!(arr.element_offset(weird_elm), None); // Points between element 0 and 1
47644760
/// ```
47654761
#[must_use]
4766-
#[unstable(feature = "substr_range", issue = "126769")]
4762+
#[stable(feature = "substr_range", since = "CURRENT_RUSTC_VERSION")]
47674763
pub fn element_offset(&self, element: &T) -> Option<usize> {
47684764
if T::IS_ZST {
47694765
panic!("elements are zero-sized");
@@ -4803,8 +4799,6 @@ impl<T> [T] {
48034799
/// # Examples
48044800
/// Basic usage:
48054801
/// ```
4806-
/// #![feature(substr_range)]
4807-
///
48084802
/// let nums = &[0, 5, 10, 0, 0, 5];
48094803
///
48104804
/// let mut iter = nums
@@ -4817,7 +4811,7 @@ impl<T> [T] {
48174811
/// assert_eq!(iter.next(), Some(5..6));
48184812
/// ```
48194813
#[must_use]
4820-
#[unstable(feature = "substr_range", issue = "126769")]
4814+
#[stable(feature = "substr_range", since = "CURRENT_RUSTC_VERSION")]
48214815
pub fn subslice_range(&self, subslice: &[T]) -> Option<Range<usize>> {
48224816
if T::IS_ZST {
48234817
panic!("elements are zero-sized");

library/core/src/str/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2950,8 +2950,6 @@ impl str {
29502950
///
29512951
/// # Examples
29522952
/// ```
2953-
/// #![feature(substr_range)]
2954-
///
29552953
/// let data = "a, b, b, a";
29562954
/// let mut iter = data.split(", ").map(|s| data.substr_range(s).unwrap());
29572955
///
@@ -2961,7 +2959,7 @@ impl str {
29612959
/// assert_eq!(iter.next(), Some(9..10));
29622960
/// ```
29632961
#[must_use]
2964-
#[unstable(feature = "substr_range", issue = "126769")]
2962+
#[stable(feature = "substr_range", since = "CURRENT_RUSTC_VERSION")]
29652963
pub fn substr_range(&self, substr: &str) -> Option<Range<usize>> {
29662964
self.as_bytes().subslice_range(substr.as_bytes())
29672965
}

0 commit comments

Comments
 (0)