Skip to content

Commit db8520a

Browse files
committed
CString and NulError are in alloc.
1 parent 7ec664a commit db8520a

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ fn main() {
1818
{
1919
use_feature_or_nothing("const_raw_ptr_deref");
2020
use_feature_or_nothing("core_c_str");
21+
use_feature_or_nothing("alloc_c_string");
2122
}
2223

2324
// Gather target information.

src/ffi/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
//! Utilities related to FFI bindings.
22
33
#[cfg(not(feature = "std"))]
4-
pub use core::ffi::{CStr, CString, FromBytesWithNulError, NulError};
4+
pub use alloc::ffi::{CString, NulError};
5+
#[cfg(not(feature = "std"))]
6+
pub use core::ffi::{CStr, FromBytesWithNulError};
57

68
#[cfg(feature = "std")]
79
pub use std::ffi::{CStr, CString, FromBytesWithNulError, NulError};

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@
103103
)]
104104
#![cfg_attr(io_lifetimes_use_std, feature(io_safety))]
105105
#![cfg_attr(core_c_str, feature(core_c_str))]
106+
#![cfg_attr(alloc_c_string, feature(alloc_ffi))]
107+
#![cfg_attr(alloc_c_string, feature(alloc_c_string))]
106108
#![cfg_attr(not(feature = "std"), no_std)]
107109
#![cfg_attr(feature = "rustc-dep-of-std", feature(core_intrinsics))]
108110
#![cfg_attr(feature = "rustc-dep-of-std", feature(ip))]

0 commit comments

Comments
 (0)