Skip to content

Commit 16707d4

Browse files
committed
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
1 parent 20b4f86 commit 16707d4

File tree

6 files changed

+6
-16
lines changed

6 files changed

+6
-16
lines changed

src/liballoc/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@
115115
#![feature(specialization)]
116116
#![feature(staged_api)]
117117
#![feature(str_internals)]
118-
#![feature(str_mut_extras)]
119118
#![feature(trusted_len)]
120119
#![feature(unboxed_closures)]
121120
#![feature(unicode)]

src/liballoc/str.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ impl str {
290290
}
291291

292292
/// Converts a mutable string slice to a mutable byte slice.
293-
#[unstable(feature = "str_mut_extras", issue = "41119")]
293+
#[stable(feature = "str_mut_extras", since = "1.20.0")]
294294
#[inline(always)]
295295
pub unsafe fn as_bytes_mut(&mut self) -> &mut [u8] {
296296
core_str::StrExt::as_bytes_mut(self)
@@ -1725,7 +1725,7 @@ impl str {
17251725
}
17261726

17271727
/// Converts a `Box<str>` into a `Box<[u8]>` without copying or allocating.
1728-
#[unstable(feature = "str_box_extras", issue = "41119")]
1728+
#[stable(feature = "str_box_extras", since = "1.20.0")]
17291729
pub fn into_boxed_bytes(self: Box<str>) -> Box<[u8]> {
17301730
self.into()
17311731
}
@@ -1992,7 +1992,7 @@ impl str {
19921992

19931993
/// Converts a boxed slice of bytes to a boxed string slice without checking
19941994
/// that the string contains valid UTF-8.
1995-
#[unstable(feature = "str_box_extras", issue = "41119")]
1995+
#[stable(feature = "str_box_extras", since = "1.20.0")]
19961996
pub unsafe fn from_boxed_utf8_unchecked(v: Box<[u8]>) -> Box<str> {
19971997
mem::transmute(v)
19981998
}

src/libcore/str/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ pub fn from_utf8(v: &[u8]) -> Result<&str, Utf8Error> {
301301
}
302302

303303
/// Converts a mutable slice of bytes to a mutable string slice.
304-
#[unstable(feature = "str_mut_extras", issue = "41119")]
304+
#[stable(feature = "str_mut_extras", since = "1.20.0")]
305305
pub fn from_utf8_mut(v: &mut [u8]) -> Result<&mut str, Utf8Error> {
306306
run_utf8_validation(v)?;
307307
Ok(unsafe { from_utf8_unchecked_mut(v) })
@@ -382,7 +382,7 @@ pub unsafe fn from_utf8_unchecked(v: &[u8]) -> &str {
382382
///
383383
/// [fromutf8]: fn.from_utf8_unchecked.html
384384
#[inline]
385-
#[unstable(feature = "str_mut_extras", issue = "41119")]
385+
#[stable(feature = "str_mut_extras", since = "1.20.0")]
386386
pub unsafe fn from_utf8_unchecked_mut(v: &mut [u8]) -> &mut str {
387387
mem::transmute(v)
388388
}
@@ -2123,7 +2123,7 @@ pub trait StrExt {
21232123
fn is_char_boundary(&self, index: usize) -> bool;
21242124
#[stable(feature = "core", since = "1.6.0")]
21252125
fn as_bytes(&self) -> &[u8];
2126-
#[unstable(feature = "str_mut_extras", issue = "41119")]
2126+
#[stable(feature = "str_mut_extras", since = "1.20.0")]
21272127
unsafe fn as_bytes_mut(&mut self) -> &mut [u8];
21282128
#[stable(feature = "core", since = "1.6.0")]
21292129
fn find<'a, P: Pattern<'a>>(&'a self, pat: P) -> Option<usize>;

src/libstd/ffi/c_str.rs

-6
Original file line numberDiff line numberDiff line change
@@ -453,8 +453,6 @@ impl CString {
453453
/// # Examples
454454
///
455455
/// ```
456-
/// #![feature(as_c_str)]
457-
///
458456
/// use std::ffi::{CString, CStr};
459457
///
460458
/// let c_string = CString::new(b"foo".to_vec()).unwrap();
@@ -474,8 +472,6 @@ impl CString {
474472
/// # Examples
475473
///
476474
/// ```
477-
/// #![feature(into_boxed_c_str)]
478-
///
479475
/// use std::ffi::{CString, CStr};
480476
///
481477
/// let c_string = CString::new(b"foo".to_vec()).unwrap();
@@ -1001,8 +997,6 @@ impl CStr {
1001997
/// # Examples
1002998
///
1003999
/// ```
1004-
/// #![feature(into_boxed_c_str)]
1005-
///
10061000
/// use std::ffi::CString;
10071001
///
10081002
/// let c_string = CString::new(b"foo".to_vec()).unwrap();

src/libstd/ffi/os_str.rs

-2
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,6 @@ impl OsString {
252252
/// # Examples
253253
///
254254
/// ```
255-
/// #![feature(into_boxed_os_str)]
256-
///
257255
/// use std::ffi::{OsString, OsStr};
258256
///
259257
/// let s = OsString::from("hello");

src/libstd/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,6 @@
303303
#![feature(stmt_expr_attributes)]
304304
#![feature(str_char)]
305305
#![feature(str_internals)]
306-
#![feature(str_mut_extras)]
307306
#![feature(str_utf16)]
308307
#![feature(test, rustc_private)]
309308
#![feature(thread_local)]

0 commit comments

Comments
 (0)