Skip to content

Commit f9f7347

Browse files
committed
Cleaner c_char cfg logic
1 parent fc60b2c commit f9f7347

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

src/libstd/ffi/c_str.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,10 @@ use vec::Vec;
3737
///
3838
/// A `CString` is created from either a byte slice or a byte vector. After
3939
/// being created, a `CString` predominately inherits all of its methods from
40-
/// the `Deref` implementation to `[os::raw::c_char]`. Note that the underlying
41-
/// array is represented as an array of `os::raw::c_char` as opposed to `u8`. A
42-
/// `u8` slice can be obtained with the `as_bytes` method. Slices produced from
43-
/// a `CString` do *not* contain the trailing nul terminator unless otherwise
44-
/// specified.
40+
/// the `Deref` implementation to `[c_char]`. Note that the underlying array
41+
/// is represented as an array of `c_char` as opposed to `u8`. A `u8` slice
42+
/// can be obtained with the `as_bytes` method. Slices produced from a `CString`
43+
/// do *not* contain the trailing nul terminator unless otherwise specified.
4544
///
4645
/// # Examples
4746
///

src/libstd/os/raw.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
1313
#![stable(feature = "raw_os", since = "1.1.0")]
1414

15-
#[cfg(all(not(target_os = "ios"), not(target_os = "macos"),
16-
any(target_arch = "aarch64", target_arch = "arm",
17-
target_os = "android")))]
15+
#[cfg(any(target_os = "android",
16+
all(target_os = "linux", any(target_arch = "aarch64",
17+
target_arch = "arm"))))]
1818
#[stable(feature = "raw_os", since = "1.1.0")] pub type c_char = u8;
19-
#[cfg(any(target_os = "ios", target_os = "macos",
20-
not(any(target_arch = "aarch64", target_arch = "arm",
21-
target_os = "android"))))]
19+
#[cfg(not(any(target_os = "android",
20+
all(target_os = "linux", any(target_arch = "aarch64",
21+
target_arch = "arm")))))]
2222
#[stable(feature = "raw_os", since = "1.1.0")] pub type c_char = i8;
2323
#[stable(feature = "raw_os", since = "1.1.0")] pub type c_schar = i8;
2424
#[stable(feature = "raw_os", since = "1.1.0")] pub type c_uchar = u8;

0 commit comments

Comments
 (0)