Skip to content

Commit 2d389c1

Browse files
committed
std: Stabilize the str_matches feature
This commit stabilizes the `str::{matches, rmatches}` functions and iterators, but renames the unstable feature for the `str::{matches,rmatches}_indices` function to `str_match_indices` due to the comment present on the functions about the iterator's return value.
1 parent 17a1059 commit 2d389c1

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/libcollections/str.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1527,8 +1527,7 @@ impl str {
15271527
/// let v: Vec<&str> = "1abc2abc3".matches(char::is_numeric).collect();
15281528
/// assert_eq!(v, ["1", "2", "3"]);
15291529
/// ```
1530-
#[unstable(feature = "str_matches",
1531-
reason = "method got recently added")]
1530+
#[stable(feature = "str_matches", since = "1.2.0")]
15321531
pub fn matches<'a, P: Pattern<'a>>(&'a self, pat: P) -> Matches<'a, P> {
15331532
core_str::StrExt::matches(self, pat)
15341533
}
@@ -1560,8 +1559,7 @@ impl str {
15601559
/// let v: Vec<&str> = "1abc2abc3".rmatches(char::is_numeric).collect();
15611560
/// assert_eq!(v, ["3", "2", "1"]);
15621561
/// ```
1563-
#[unstable(feature = "str_matches",
1564-
reason = "method got recently added")]
1562+
#[stable(feature = "str_matches", since = "1.2.0")]
15651563
pub fn rmatches<'a, P: Pattern<'a>>(&'a self, pat: P) -> RMatches<'a, P>
15661564
where P::Searcher: ReverseSearcher<'a>
15671565
{
@@ -1605,7 +1603,7 @@ impl str {
16051603
/// let v: Vec<(usize, usize)> = "ababa".match_indices("aba").collect();
16061604
/// assert_eq!(v, [(0, 3)]); // only the first `aba`
16071605
/// ```
1608-
#[unstable(feature = "str_matches",
1606+
#[unstable(feature = "str_match_indices",
16091607
reason = "might have its iterator type changed")]
16101608
// NB: Right now MatchIndices yields `(usize, usize)`, but it would
16111609
// be more consistent with `matches` and `char_indices` to return `(usize, &str)`
@@ -1649,7 +1647,7 @@ impl str {
16491647
/// let v: Vec<(usize, usize)> = "ababa".rmatch_indices("aba").collect();
16501648
/// assert_eq!(v, [(2, 5)]); // only the last `aba`
16511649
/// ```
1652-
#[unstable(feature = "str_matches",
1650+
#[unstable(feature = "str_match_indices",
16531651
reason = "might have its iterator type changed")]
16541652
// NB: Right now RMatchIndices yields `(usize, usize)`, but it would
16551653
// be more consistent with `rmatches` and `char_indices` to return `(usize, &str)`

src/libcore/str/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ generate_pattern_iterators! {
738738
#[doc="Created with the method `.rmatch_indices()`."]
739739
struct RMatchIndices;
740740
stability:
741-
#[unstable(feature = "str_internals",
741+
#[unstable(feature = "str_match_indices",
742742
reason = "type may be removed or have its iterator impl changed")]
743743
internal:
744744
MatchIndicesInternal yielding ((usize, usize));
@@ -779,7 +779,7 @@ generate_pattern_iterators! {
779779
#[doc="Created with the method `.rmatches()`."]
780780
struct RMatches;
781781
stability:
782-
#[unstable(feature = "str_internals", reason = "type got recently added")]
782+
#[stable(feature = "str_matches", since = "1.2.0")]
783783
internal:
784784
MatchesInternal yielding (&'a str);
785785
delegate double ended;

0 commit comments

Comments
 (0)