提交 16707d43 编写于 作者: A Alex Crichton

std: Stabilize the `str_{mut,box}_extras` feature

Stabilizes

* `<&mut str>::as_bytes_mut`
* `<Box<str>>::into_boxed_bytes`
* `std::str::from_boxed_utf8_unchecked`
* `std::str::from_utf8_mut`
* `std::str::from_utf8_unchecked_mut`

Closes #41119
上级 20b4f86d
......@@ -115,7 +115,6 @@
#![feature(specialization)]
#![feature(staged_api)]
#![feature(str_internals)]
#![feature(str_mut_extras)]
#![feature(trusted_len)]
#![feature(unboxed_closures)]
#![feature(unicode)]
......
......@@ -290,7 +290,7 @@ pub fn as_bytes(&self) -> &[u8] {
}
/// Converts a mutable string slice to a mutable byte slice.
#[unstable(feature = "str_mut_extras", issue = "41119")]
#[stable(feature = "str_mut_extras", since = "1.20.0")]
#[inline(always)]
pub unsafe fn as_bytes_mut(&mut self) -> &mut [u8] {
core_str::StrExt::as_bytes_mut(self)
......@@ -1725,7 +1725,7 @@ pub fn parse<F: FromStr>(&self) -> Result<F, F::Err> {
}
/// Converts a `Box<str>` into a `Box<[u8]>` without copying or allocating.
#[unstable(feature = "str_box_extras", issue = "41119")]
#[stable(feature = "str_box_extras", since = "1.20.0")]
pub fn into_boxed_bytes(self: Box<str>) -> Box<[u8]> {
self.into()
}
......@@ -1992,7 +1992,7 @@ pub fn repeat(&self, n: usize) -> String {
/// Converts a boxed slice of bytes to a boxed string slice without checking
/// that the string contains valid UTF-8.
#[unstable(feature = "str_box_extras", issue = "41119")]
#[stable(feature = "str_box_extras", since = "1.20.0")]
pub unsafe fn from_boxed_utf8_unchecked(v: Box<[u8]>) -> Box<str> {
mem::transmute(v)
}
......@@ -301,7 +301,7 @@ pub fn from_utf8(v: &[u8]) -> Result<&str, Utf8Error> {
}
/// Converts a mutable slice of bytes to a mutable string slice.
#[unstable(feature = "str_mut_extras", issue = "41119")]
#[stable(feature = "str_mut_extras", since = "1.20.0")]
pub fn from_utf8_mut(v: &mut [u8]) -> Result<&mut str, Utf8Error> {
run_utf8_validation(v)?;
Ok(unsafe { from_utf8_unchecked_mut(v) })
......@@ -382,7 +382,7 @@ pub unsafe fn from_utf8_unchecked(v: &[u8]) -> &str {
///
/// [fromutf8]: fn.from_utf8_unchecked.html
#[inline]
#[unstable(feature = "str_mut_extras", issue = "41119")]
#[stable(feature = "str_mut_extras", since = "1.20.0")]
pub unsafe fn from_utf8_unchecked_mut(v: &mut [u8]) -> &mut str {
mem::transmute(v)
}
......@@ -2123,7 +2123,7 @@ fn trim_right_matches<'a, P: Pattern<'a>>(&'a self, pat: P) -> &'a str
fn is_char_boundary(&self, index: usize) -> bool;
#[stable(feature = "core", since = "1.6.0")]
fn as_bytes(&self) -> &[u8];
#[unstable(feature = "str_mut_extras", issue = "41119")]
#[stable(feature = "str_mut_extras", since = "1.20.0")]
unsafe fn as_bytes_mut(&mut self) -> &mut [u8];
#[stable(feature = "core", since = "1.6.0")]
fn find<'a, P: Pattern<'a>>(&'a self, pat: P) -> Option<usize>;
......
......@@ -453,8 +453,6 @@ pub fn as_bytes_with_nul(&self) -> &[u8] {
/// # Examples
///
/// ```
/// #![feature(as_c_str)]
///
/// use std::ffi::{CString, CStr};
///
/// let c_string = CString::new(b"foo".to_vec()).unwrap();
......@@ -474,8 +472,6 @@ pub fn as_c_str(&self) -> &CStr {
/// # Examples
///
/// ```
/// #![feature(into_boxed_c_str)]
///
/// use std::ffi::{CString, CStr};
///
/// let c_string = CString::new(b"foo".to_vec()).unwrap();
......@@ -1001,8 +997,6 @@ pub fn to_string_lossy(&self) -> Cow<str> {
/// # Examples
///
/// ```
/// #![feature(into_boxed_c_str)]
///
/// use std::ffi::CString;
///
/// let c_string = CString::new(b"foo".to_vec()).unwrap();
......
......@@ -252,8 +252,6 @@ pub fn shrink_to_fit(&mut self) {
/// # Examples
///
/// ```
/// #![feature(into_boxed_os_str)]
///
/// use std::ffi::{OsString, OsStr};
///
/// let s = OsString::from("hello");
......
......@@ -303,7 +303,6 @@
#![feature(stmt_expr_attributes)]
#![feature(str_char)]
#![feature(str_internals)]
#![feature(str_mut_extras)]
#![feature(str_utf16)]
#![feature(test, rustc_private)]
#![feature(thread_local)]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册