Skip to content

Commit 0ab4250

Browse files
committed
Stabilize substr_range and related methods
1 parent 32fe406 commit 0ab4250

2 files changed

Lines changed: 2 additions & 6 deletions

File tree

library/core/src/slice/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4870,8 +4870,6 @@ impl<T> [T] {
48704870
/// # Examples
48714871
/// Basic usage:
48724872
/// ```
4873-
/// #![feature(substr_range)]
4874-
///
48754873
/// let nums = &[0, 5, 10, 0, 0, 5];
48764874
///
48774875
/// let mut iter = nums
@@ -4884,7 +4882,7 @@ impl<T> [T] {
48844882
/// assert_eq!(iter.next(), Some(5..6));
48854883
/// ```
48864884
#[must_use]
4887-
#[unstable(feature = "substr_range", issue = "126769")]
4885+
#[stable(feature = "substr_range", since = "CURRENT_RUSTC_VERSION")]
48884886
pub fn subslice_range(&self, subslice: &[T]) -> Option<Range<usize>> {
48894887
if T::IS_ZST {
48904888
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
@@ -3099,8 +3099,6 @@ impl str {
30993099
///
31003100
/// # Examples
31013101
/// ```
3102-
/// #![feature(substr_range)]
3103-
///
31043102
/// let data = "a, b, b, a";
31053103
/// let mut iter = data.split(", ").map(|s| data.substr_range(s).unwrap());
31063104
///
@@ -3110,7 +3108,7 @@ impl str {
31103108
/// assert_eq!(iter.next(), Some(9..10));
31113109
/// ```
31123110
#[must_use]
3113-
#[unstable(feature = "substr_range", issue = "126769")]
3111+
#[stable(feature = "substr_range", since = "CURRENT_RUSTC_VERSION")]
31143112
pub fn substr_range(&self, substr: &str) -> Option<Range<usize>> {
31153113
self.as_bytes().subslice_range(substr.as_bytes())
31163114
}

0 commit comments

Comments
 (0)