Skip to content

Commit 2c58efe

Browse files
committed
Stabilize substr_range and related methods
1 parent c6d42d7 commit 2c58efe

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
@@ -4794,8 +4794,6 @@ impl<T> [T] {
47944794
/// # Examples
47954795
/// Basic usage:
47964796
/// ```
4797-
/// #![feature(substr_range)]
4798-
///
47994797
/// let nums: &[u32] = &[1, 7, 1, 1];
48004798
/// let num = &nums[2];
48014799
///
@@ -4804,8 +4802,6 @@ impl<T> [T] {
48044802
/// ```
48054803
/// Returning `None` with an unaligned element:
48064804
/// ```
4807-
/// #![feature(substr_range)]
4808-
///
48094805
/// let arr: &[[u32; 2]] = &[[0, 1], [2, 3]];
48104806
/// let flat_arr: &[u32] = arr.as_flattened();
48114807
///
@@ -4819,7 +4815,7 @@ impl<T> [T] {
48194815
/// assert_eq!(arr.element_offset(weird_elm), None); // Points between element 0 and 1
48204816
/// ```
48214817
#[must_use]
4822-
#[unstable(feature = "substr_range", issue = "126769")]
4818+
#[stable(feature = "substr_range", since = "CURRENT_RUSTC_VERSION")]
48234819
pub fn element_offset(&self, element: &T) -> Option<usize> {
48244820
if T::IS_ZST {
48254821
panic!("elements are zero-sized");
@@ -4859,8 +4855,6 @@ impl<T> [T] {
48594855
/// # Examples
48604856
/// Basic usage:
48614857
/// ```
4862-
/// #![feature(substr_range)]
4863-
///
48644858
/// let nums = &[0, 5, 10, 0, 0, 5];
48654859
///
48664860
/// let mut iter = nums
@@ -4873,7 +4867,7 @@ impl<T> [T] {
48734867
/// assert_eq!(iter.next(), Some(5..6));
48744868
/// ```
48754869
#[must_use]
4876-
#[unstable(feature = "substr_range", issue = "126769")]
4870+
#[stable(feature = "substr_range", since = "CURRENT_RUSTC_VERSION")]
48774871
pub fn subslice_range(&self, subslice: &[T]) -> Option<Range<usize>> {
48784872
if T::IS_ZST {
48794873
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
@@ -3051,8 +3051,6 @@ impl str {
30513051
///
30523052
/// # Examples
30533053
/// ```
3054-
/// #![feature(substr_range)]
3055-
///
30563054
/// let data = "a, b, b, a";
30573055
/// let mut iter = data.split(", ").map(|s| data.substr_range(s).unwrap());
30583056
///
@@ -3062,7 +3060,7 @@ impl str {
30623060
/// assert_eq!(iter.next(), Some(9..10));
30633061
/// ```
30643062
#[must_use]
3065-
#[unstable(feature = "substr_range", issue = "126769")]
3063+
#[stable(feature = "substr_range", since = "CURRENT_RUSTC_VERSION")]
30663064
pub fn substr_range(&self, substr: &str) -> Option<Range<usize>> {
30673065
self.as_bytes().subslice_range(substr.as_bytes())
30683066
}

0 commit comments

Comments
 (0)