-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add std::ffi::c_str module #112136
Add std::ffi::c_str module #112136
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
//! [`CString`] and its related types. | ||
|
||
#[cfg(test)] | ||
mod tests; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
//! [`CStr`], [`CString`], and related types. | ||
|
||
#[stable(feature = "rust1", since = "1.0.0")] | ||
pub use core::ffi::c_str::CStr; | ||
|
||
#[stable(feature = "cstr_from_bytes", since = "1.10.0")] | ||
pub use core::ffi::c_str::FromBytesWithNulError; | ||
|
||
#[stable(feature = "cstr_from_bytes_until_nul", since = "1.69.0")] | ||
pub use core::ffi::c_str::FromBytesUntilNulError; | ||
|
||
#[stable(feature = "rust1", since = "1.0.0")] | ||
pub use alloc::ffi::c_str::{CString, NulError}; | ||
|
||
#[stable(feature = "cstring_from_vec_with_nul", since = "1.58.0")] | ||
pub use alloc::ffi::c_str::FromVecWithNulError; | ||
|
||
#[stable(feature = "cstring_into", since = "1.7.0")] | ||
pub use alloc::ffi::c_str::IntoStringError; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -161,12 +161,32 @@ | |
|
||
#![stable(feature = "rust1", since = "1.0.0")] | ||
|
||
#[stable(feature = "alloc_c_string", since = "1.64.0")] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The stability attributes for these also got lost in refactoring. It makes things much more verbose, but I decided to keep it so the attributes were preserved. |
||
pub use alloc::ffi::{CString, FromVecWithNulError, IntoStringError, NulError}; | ||
#[stable(feature = "cstr_from_bytes_until_nul", since = "1.73.0")] | ||
pub use core::ffi::FromBytesUntilNulError; | ||
#[stable(feature = "core_c_str", since = "1.64.0")] | ||
pub use core::ffi::{CStr, FromBytesWithNulError}; | ||
#[unstable(feature = "c_str_module", issue = "112134")] | ||
pub mod c_str; | ||
|
||
#[doc(inline)] | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
pub use self::c_str::{CStr, CString}; | ||
|
||
#[doc(no_inline)] | ||
#[stable(feature = "cstr_from_bytes", since = "1.10.0")] | ||
pub use self::c_str::FromBytesWithNulError; | ||
|
||
#[doc(no_inline)] | ||
#[stable(feature = "cstr_from_bytes_until_nul", since = "1.69.0")] | ||
pub use self::c_str::FromBytesUntilNulError; | ||
|
||
#[doc(no_inline)] | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
pub use self::c_str::NulError; | ||
|
||
#[doc(no_inline)] | ||
#[stable(feature = "cstring_from_vec_with_nul", since = "1.58.0")] | ||
pub use self::c_str::FromVecWithNulError; | ||
|
||
#[doc(no_inline)] | ||
#[stable(feature = "cstring_into", since = "1.7.0")] | ||
pub use self::c_str::IntoStringError; | ||
|
||
#[stable(feature = "rust1", since = "1.0.0")] | ||
pub use self::os_str::{OsStr, OsString}; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -314,6 +314,7 @@ | |
// | ||
// Library features (core): | ||
// tidy-alphabetical-start | ||
#![feature(c_str_module)] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. technically I could make it work without these but I prefer the clarity of importing from the modules instead of the re-exports. |
||
#![feature(char_internals)] | ||
#![feature(core_intrinsics)] | ||
#![feature(core_io_borrowed_buf)] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This stability attribute got lost in some refactoring, I think. I decided to restore it when I was fixing up the code.