Move os_str_bytes to sys::unix and reuse it on other platforms.

This commit is contained in:
Christiaan Dirkx 2021-06-21 11:44:59 +02:00
parent 798baebde1
commit c93cb40b90
10 changed files with 12 additions and 14 deletions

View File

@ -32,6 +32,8 @@ pub mod memchr;
pub mod mutex;
pub mod net;
pub mod os;
#[path = "../unix/os_str.rs"]
pub mod os_str;
#[path = "../unix/path.rs"]
pub mod path;
#[path = "../unsupported/pipe.rs"]
@ -47,7 +49,6 @@ pub mod thread_local_key;
pub mod time;
use crate::io::ErrorKind;
pub use crate::sys_common::os_str_bytes as os_str;
#[allow(unused_extern_crates)]
pub extern crate hermit_abi as abi;

View File

@ -26,6 +26,8 @@ pub mod memchr;
pub mod mutex;
pub mod net;
pub mod os;
#[path = "../unix/os_str.rs"]
pub mod os_str;
pub mod path;
#[path = "../unsupported/pipe.rs"]
pub mod pipe;
@ -37,8 +39,6 @@ pub mod thread;
pub mod thread_local_key;
pub mod time;
pub use crate::sys_common::os_str_bytes as os_str;
// SAFETY: must be called only once during runtime initialization.
// NOTE: this is not guaranteed to run, for example when Rust code is called externally.
pub unsafe fn init(argc: isize, argv: *const *const u8) {

View File

@ -30,6 +30,7 @@ pub mod net;
#[cfg(target_os = "l4re")]
pub use self::l4re::net;
pub mod os;
pub mod os_str;
pub mod path;
pub mod pipe;
pub mod process;
@ -42,8 +43,6 @@ pub mod thread_local_dtor;
pub mod thread_local_key;
pub mod time;
pub use crate::sys_common::os_str_bytes as os_str;
// SAFETY: must be called only once during runtime initialization.
// NOTE: this is not guaranteed to run, for example when Rust code is called externally.
pub unsafe fn init(argc: isize, argv: *const *const u8) {

View File

@ -13,6 +13,7 @@ use crate::sys_common::{AsInner, IntoInner};
use core::str::lossy::{Utf8Lossy, Utf8LossyChunk};
#[cfg(test)]
#[path = "../unix/os_str/tests.rs"]
mod tests;
#[derive(Hash)]

View File

@ -4,8 +4,6 @@ pub mod memchr {
pub use core::slice::memchr::{memchr, memrchr};
}
pub use crate::sys_common::os_str_bytes as os_str;
// This is not necessarily correct. May want to consider making it part of the
// spec definition?
use crate::os::raw::c_char;

View File

@ -11,6 +11,8 @@ pub mod io;
pub mod mutex;
pub mod net;
pub mod os;
#[path = "../unix/os_str.rs"]
pub mod os_str;
#[path = "../unix/path.rs"]
pub mod path;
pub mod pipe;

View File

@ -32,7 +32,8 @@ pub mod io;
pub mod mutex;
pub mod net;
pub mod os;
pub use crate::sys_common::os_str_bytes as os_str;
#[path = "../unix/os_str.rs"]
pub mod os_str;
#[path = "../unix/path.rs"]
pub mod path;
#[path = "../unsupported/pipe.rs"]

View File

@ -30,6 +30,8 @@ pub mod io;
pub mod net;
#[path = "../unsupported/os.rs"]
pub mod os;
#[path = "../unix/os_str.rs"]
pub mod os_str;
#[path = "../unix/path.rs"]
pub mod path;
#[path = "../unsupported/pipe.rs"]
@ -45,8 +47,6 @@ pub mod thread_local_key;
#[path = "../unsupported/time.rs"]
pub mod time;
pub use crate::sys_common::os_str_bytes as os_str;
cfg_if::cfg_if! {
if #[cfg(target_feature = "atomics")] {
#[path = "atomics/condvar.rs"]

View File

@ -26,10 +26,6 @@ pub mod fs;
pub mod io;
pub mod memchr;
pub mod mutex;
// `doc` is required because `sys/mod.rs` imports `unix/ext/mod.rs` on Windows
// when generating documentation.
#[cfg(any(doc, not(windows)))]
pub mod os_str_bytes;
pub mod process;
pub mod remutex;
#[macro_use]