Skip to content

Commit 267b73d

Browse files
committed
std: Fixup some missing stabilization on str
* The `str` module itself is stable. * The `StrExt` trait is stable (and impls). * The `Utf8Error` type is unstable. * The `from_utf8` function is stable * Some iterators are now stable: * `Chars` * `CharIndices` * The `MatchIndices` iterator is now unstable * The public `traits` module is no longer public.
1 parent ed22606 commit 267b73d

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/libcollections/str.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
//! is the same as `&[u8]`.
5151
5252
#![doc(primitive = "str")]
53+
#![stable]
5354

5455
use self::RecompositionState::*;
5556
use self::DecompositionType::*;
@@ -401,6 +402,7 @@ Section: Trait implementations
401402
*/
402403

403404
/// Any string that can be represented as a slice.
405+
#[stable]
404406
pub trait StrExt for Sized?: ops::Slice<uint, str> {
405407
/// Escapes each char in `s` with `char::escape_default`.
406408
#[unstable = "return type may change to be an iterator"]
@@ -1340,6 +1342,7 @@ pub trait StrExt for Sized?: ops::Slice<uint, str> {
13401342
}
13411343
}
13421344

1345+
#[stable]
13431346
impl StrExt for str {}
13441347

13451348
#[cfg(test)]

src/libcore/str/mod.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ Section: Creating a string
142142

143143
/// Errors which can occur when attempting to interpret a byte slice as a `str`.
144144
#[derive(Copy, Eq, PartialEq, Clone)]
145+
#[unstable = "error enumeration recently added and definitions may be refined"]
145146
pub enum Utf8Error {
146147
/// An invalid byte was detected at the byte offset given.
147148
///
@@ -165,6 +166,7 @@ pub enum Utf8Error {
165166
///
166167
/// Returns `Err` if the slice is not utf-8 with a description as to why the
167168
/// provided slice is not utf-8.
169+
#[stable]
168170
pub fn from_utf8(v: &[u8]) -> Result<&str, Utf8Error> {
169171
try!(run_utf8_validation_iterator(&mut v.iter()));
170172
Ok(unsafe { from_utf8_unchecked(v) })
@@ -247,6 +249,7 @@ Section: Iterators
247249
///
248250
/// Created with the method `.chars()`.
249251
#[derive(Clone, Copy)]
252+
#[stable]
250253
pub struct Chars<'a> {
251254
iter: slice::Iter<'a, u8>
252255
}
@@ -356,6 +359,7 @@ impl<'a> DoubleEndedIterator for Chars<'a> {
356359
/// External iterator for a string's characters and their byte offsets.
357360
/// Use with the `std::iter` module.
358361
#[derive(Clone)]
362+
#[stable]
359363
pub struct CharIndices<'a> {
360364
front_offset: uint,
361365
iter: Chars<'a>,
@@ -848,6 +852,7 @@ impl Searcher {
848852
/// An iterator over the start and end indices of the matches of a
849853
/// substring within a larger string
850854
#[derive(Clone)]
855+
#[unstable = "type may be removed"]
851856
pub struct MatchIndices<'a> {
852857
// constants
853858
haystack: &'a str,
@@ -858,7 +863,7 @@ pub struct MatchIndices<'a> {
858863
/// An iterator over the substrings of a string separated by a given
859864
/// search string
860865
#[derive(Clone)]
861-
#[unstable = "Type might get removed"]
866+
#[unstable = "type may be removed"]
862867
pub struct SplitStr<'a> {
863868
it: MatchIndices<'a>,
864869
last_end: uint,
@@ -1056,8 +1061,7 @@ const TAG_CONT_U8: u8 = 0b1000_0000u8;
10561061
Section: Trait implementations
10571062
*/
10581063

1059-
#[allow(missing_docs)]
1060-
pub mod traits {
1064+
mod traits {
10611065
use cmp::{Ordering, Ord, PartialEq, PartialOrd, Eq};
10621066
use cmp::Ordering::{Less, Equal, Greater};
10631067
use iter::IteratorExt;

0 commit comments

Comments
 (0)