Skip to content

Commit 6284d7b

Browse files
committed
Auto merge of #152971 - GrigorenkoPV:str_as_str, r=<try>
[DO NOT MERGE] Revert "Revert "Stabilize `str_as_str`""
2 parents eeb94be + df3bedb commit 6284d7b

7 files changed

Lines changed: 12 additions & 9 deletions

File tree

library/alloctests/tests/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
#![feature(thin_box)]
3434
#![feature(drain_keep_rest)]
3535
#![feature(local_waker)]
36-
#![feature(str_as_str)]
3736
#![feature(strict_provenance_lints)]
3837
#![feature(string_replace_in_place)]
3938
#![feature(vec_deque_truncate_front)]

library/core/src/bstr/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ impl ByteStr {
7474
/// it helps dereferencing other "container" types,
7575
/// for example `Box<ByteStr>` or `Arc<ByteStr>`.
7676
#[inline]
77-
// #[unstable(feature = "str_as_str", issue = "130366")]
7877
#[unstable(feature = "bstr", issue = "134915")]
7978
pub const fn as_byte_str(&self) -> &ByteStr {
8079
self
@@ -86,7 +85,6 @@ impl ByteStr {
8685
/// it helps dereferencing other "container" types,
8786
/// for example `Box<ByteStr>` or `MutexGuard<ByteStr>`.
8887
#[inline]
89-
// #[unstable(feature = "str_as_str", issue = "130366")]
9088
#[unstable(feature = "bstr", issue = "134915")]
9189
pub const fn as_mut_byte_str(&mut self) -> &mut ByteStr {
9290
self

library/core/src/ffi/c_str.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,8 @@ impl CStr {
655655
/// it helps dereferencing other string-like types to string slices,
656656
/// for example references to `Box<CStr>` or `Arc<CStr>`.
657657
#[inline]
658-
#[unstable(feature = "str_as_str", issue = "130366")]
658+
#[stable(feature = "str_as_str", since = "CURRENT_RUSTC_VERSION")]
659+
#[rustc_const_stable(feature = "str_as_str", since = "CURRENT_RUSTC_VERSION")]
659660
pub const fn as_c_str(&self) -> &CStr {
660661
self
661662
}

library/core/src/slice/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5337,7 +5337,8 @@ impl<T> [T] {
53375337
/// it helps dereferencing other "container" types to slices,
53385338
/// for example `Box<[T]>` or `Arc<[T]>`.
53395339
#[inline]
5340-
#[unstable(feature = "str_as_str", issue = "130366")]
5340+
#[stable(feature = "str_as_str", since = "CURRENT_RUSTC_VERSION")]
5341+
#[rustc_const_stable(feature = "str_as_str", since = "CURRENT_RUSTC_VERSION")]
53415342
pub const fn as_slice(&self) -> &[T] {
53425343
self
53435344
}
@@ -5348,7 +5349,8 @@ impl<T> [T] {
53485349
/// it helps dereferencing other "container" types to slices,
53495350
/// for example `Box<[T]>` or `MutexGuard<[T]>`.
53505351
#[inline]
5351-
#[unstable(feature = "str_as_str", issue = "130366")]
5352+
#[stable(feature = "str_as_str", since = "CURRENT_RUSTC_VERSION")]
5353+
#[rustc_const_stable(feature = "str_as_str", since = "CURRENT_RUSTC_VERSION")]
53525354
pub const fn as_mut_slice(&mut self) -> &mut [T] {
53535355
self
53545356
}

library/core/src/str/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3137,7 +3137,8 @@ impl str {
31373137
/// it helps dereferencing other string-like types to string slices,
31383138
/// for example references to `Box<str>` or `Arc<str>`.
31393139
#[inline]
3140-
#[unstable(feature = "str_as_str", issue = "130366")]
3140+
#[stable(feature = "str_as_str", since = "CURRENT_RUSTC_VERSION")]
3141+
#[rustc_const_stable(feature = "str_as_str", since = "CURRENT_RUSTC_VERSION")]
31413142
pub const fn as_str(&self) -> &str {
31423143
self
31433144
}

library/std/src/ffi/os_str.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1285,7 +1285,8 @@ impl OsStr {
12851285
/// it helps dereferencing other string-like types to string slices,
12861286
/// for example references to `Box<OsStr>` or `Arc<OsStr>`.
12871287
#[inline]
1288-
#[unstable(feature = "str_as_str", issue = "130366")]
1288+
#[stable(feature = "str_as_str", since = "CURRENT_RUSTC_VERSION")]
1289+
#[rustc_const_stable(feature = "str_as_str", since = "CURRENT_RUSTC_VERSION")]
12891290
pub const fn as_os_str(&self) -> &OsStr {
12901291
self
12911292
}

library/std/src/path.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3235,7 +3235,8 @@ impl Path {
32353235
/// it helps dereferencing other `PathBuf`-like types to `Path`s,
32363236
/// for example references to `Box<Path>` or `Arc<Path>`.
32373237
#[inline]
3238-
#[unstable(feature = "str_as_str", issue = "130366")]
3238+
#[stable(feature = "str_as_str", since = "CURRENT_RUSTC_VERSION")]
3239+
#[rustc_const_stable(feature = "str_as_str", since = "CURRENT_RUSTC_VERSION")]
32393240
pub const fn as_path(&self) -> &Path {
32403241
self
32413242
}

0 commit comments

Comments
 (0)