summary refs log tree commit diff
path: root/library/alloc/src
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2022-04-06 17:04:18 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2022-04-14 21:53:11 +0300
commit7f3cc2fbbfbbc257a8763ae817a69452b9a7e31d (patch)
tree4a07d582513528e76f45291d166f5da25f5f09dd /library/alloc/src
parent5bee741a08a267f68ac6c3d24dadfe927bd45008 (diff)
downloadrust-7f3cc2fbbfbbc257a8763ae817a69452b9a7e31d.tar.gz
rust-7f3cc2fbbfbbc257a8763ae817a69452b9a7e31d.zip
library: Use type aliases to make `CStr(ing)` in libcore/liballoc unstable
Diffstat (limited to 'library/alloc/src')
-rw-r--r--library/alloc/src/ffi/c_str.rs8
-rw-r--r--library/alloc/src/ffi/mod.rs4
-rw-r--r--library/alloc/src/lib.rs2
3 files changed, 8 insertions, 6 deletions
diff --git a/library/alloc/src/ffi/c_str.rs b/library/alloc/src/ffi/c_str.rs
index 21433a3baa9..6a522c0cada 100644
--- a/library/alloc/src/ffi/c_str.rs
+++ b/library/alloc/src/ffi/c_str.rs
@@ -106,7 +106,7 @@ use core::str::{self, Utf8Error};
 /// and other memory errors.
 #[derive(PartialEq, PartialOrd, Eq, Ord, Hash, Clone)]
 #[cfg_attr(not(test), rustc_diagnostic_item = "cstring_type")]
-#[stable(feature = "rust1", since = "1.0.0")]
+#[unstable(feature = "alloc_c_string", issue = "94079")]
 pub struct CString {
     // Invariant 1: the slice ends with a zero byte and has a length of at least one.
     // Invariant 2: the slice contains only one zero byte.
@@ -130,7 +130,7 @@ pub struct CString {
 /// let _: NulError = CString::new(b"f\0oo".to_vec()).unwrap_err();
 /// ```
 #[derive(Clone, PartialEq, Eq, Debug)]
-#[stable(feature = "rust1", since = "1.0.0")]
+#[unstable(feature = "alloc_c_string", issue = "94079")]
 pub struct NulError(usize, Vec<u8>);
 
 #[derive(Clone, PartialEq, Eq, Debug)]
@@ -155,7 +155,7 @@ enum FromBytesWithNulErrorKind {
 /// let _: FromVecWithNulError = CString::from_vec_with_nul(b"f\0oo".to_vec()).unwrap_err();
 /// ```
 #[derive(Clone, PartialEq, Eq, Debug)]
-#[stable(feature = "cstring_from_vec_with_nul", since = "1.58.0")]
+#[unstable(feature = "alloc_c_string", issue = "94079")]
 pub struct FromVecWithNulError {
     error_kind: FromBytesWithNulErrorKind,
     bytes: Vec<u8>,
@@ -221,7 +221,7 @@ impl FromVecWithNulError {
 /// This `struct` is created by [`CString::into_string()`]. See
 /// its documentation for more.
 #[derive(Clone, PartialEq, Eq, Debug)]
-#[stable(feature = "cstring_into", since = "1.7.0")]
+#[unstable(feature = "alloc_c_string", issue = "94079")]
 pub struct IntoStringError {
     inner: CString,
     error: Utf8Error,
diff --git a/library/alloc/src/ffi/mod.rs b/library/alloc/src/ffi/mod.rs
index 6b2e4af45b2..eed2851c153 100644
--- a/library/alloc/src/ffi/mod.rs
+++ b/library/alloc/src/ffi/mod.rs
@@ -83,9 +83,9 @@
 #[cfg(bootstrap)]
 #[unstable(feature = "cstr_internals", issue = "none")]
 pub use self::c_str::CStrExt;
-#[stable(feature = "cstring_from_vec_with_nul", since = "1.58.0")]
+#[unstable(feature = "alloc_c_string", issue = "94079")]
 pub use self::c_str::FromVecWithNulError;
-#[stable(feature = "rust1", since = "1.0.0")]
+#[unstable(feature = "alloc_c_string", issue = "94079")]
 pub use self::c_str::{CString, IntoStringError, NulError};
 
 mod c_str;
diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs
index f577afdce1e..4d2dc4ecee0 100644
--- a/library/alloc/src/lib.rs
+++ b/library/alloc/src/lib.rs
@@ -86,6 +86,7 @@
 #![allow(explicit_outlives_requirements)]
 //
 // Library features:
+#![cfg_attr(not(no_global_oom_handling), feature(alloc_c_string))]
 #![feature(alloc_layout_extra)]
 #![feature(allocator_api)]
 #![feature(array_chunks)]
@@ -105,6 +106,7 @@
 #![feature(const_maybe_uninit_write)]
 #![feature(const_maybe_uninit_as_mut_ptr)]
 #![feature(const_refs_to_cell)]
+#![feature(core_c_str)]
 #![feature(core_intrinsics)]
 #![feature(core_ffi_c)]
 #![feature(const_eval_select)]