about summary refs log tree commit diff
path: root/library/std/src/lib.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-04-15 15:47:17 +0000
committerbors <bors@rust-lang.org>2022-04-15 15:47:17 +0000
commit1e6fe5855a115ef7f17f3e17205fab7340775701 (patch)
tree10d4001f37a7a8f4780f878f9d72f9e60fc9ad73 /library/std/src/lib.rs
parent69a5ae35fe5bb507ca5987e12392dce5186480b9 (diff)
parentf62c84e6b9b9720c2a49279843029b1c50fec54e (diff)
downloadrust-1e6fe5855a115ef7f17f3e17205fab7340775701.tar.gz
rust-1e6fe5855a115ef7f17f3e17205fab7340775701.zip
Auto merge of #94079 - petrochenkov:cstr, r=joshtriplett
library: Move `CStr` to libcore, and `CString` to liballoc

Closes https://github.com/rust-lang/rust/issues/46736

Interesting points:
- Stability:
    - To make `CStr(ing)` from libcore/liballoc unusable without enabling features I had to make these structures unstable, and reexport them from libstd using stable type aliases instead of `pub use` reexports. (Because stability of `use` items is not checked.)
- Relying on target ABI in libcore is ok:
    - https://github.com/rust-lang/rust/pull/94079#issuecomment-1044263371
- `trait CStrExt` (UPDATE: used only in `cfg(bootstrap)` mode, otherwise lang items are used instead)
    - https://github.com/rust-lang/rust/pull/94079#issuecomment-1047863450
- `strlen`
    - https://github.com/rust-lang/rust/pull/94079#issuecomment-1047863450

Otherwise it's just a code move + some minor hackery usual for liballoc in `cfg(test)` mode.
Diffstat (limited to 'library/std/src/lib.rs')
-rw-r--r--library/std/src/lib.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs
index 60e7c2af8e4..039e3d59a4d 100644
--- a/library/std/src/lib.rs
+++ b/library/std/src/lib.rs
@@ -260,7 +260,10 @@
 #![feature(atomic_mut_ptr)]
 #![feature(char_error_internals)]
 #![feature(char_internals)]
+#![feature(core_c_str)]
 #![feature(core_intrinsics)]
+#![feature(cstr_from_bytes_until_nul)]
+#![feature(cstr_internals)]
 #![feature(duration_checked_float)]
 #![feature(duration_constants)]
 #![feature(exact_size_is_empty)]
@@ -286,6 +289,7 @@
 //
 // Library features (alloc):
 #![feature(alloc_layout_extra)]
+#![feature(alloc_c_string)]
 #![feature(allocator_api)]
 #![feature(get_mut_unchecked)]
 #![feature(map_try_insert)]