1
Fork 0

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

View file

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

View file

@ -30,6 +30,7 @@ pub mod net;
#[cfg(target_os = "l4re")] #[cfg(target_os = "l4re")]
pub use self::l4re::net; pub use self::l4re::net;
pub mod os; pub mod os;
pub mod os_str;
pub mod path; pub mod path;
pub mod pipe; pub mod pipe;
pub mod process; pub mod process;
@ -42,8 +43,6 @@ pub mod thread_local_dtor;
pub mod thread_local_key; pub mod thread_local_key;
pub mod time; pub mod time;
pub use crate::sys_common::os_str_bytes as os_str;
// SAFETY: must be called only once during runtime initialization. // SAFETY: must be called only once during runtime initialization.
// NOTE: this is not guaranteed to run, for example when Rust code is called externally. // 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) { 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}; use core::str::lossy::{Utf8Lossy, Utf8LossyChunk};
#[cfg(test)] #[cfg(test)]
#[path = "../unix/os_str/tests.rs"]
mod tests; mod tests;
#[derive(Hash)] #[derive(Hash)]

View file

@ -4,8 +4,6 @@ pub mod memchr {
pub use core::slice::memchr::{memchr, memrchr}; 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 // This is not necessarily correct. May want to consider making it part of the
// spec definition? // spec definition?
use crate::os::raw::c_char; use crate::os::raw::c_char;

View file

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

View file

@ -32,7 +32,8 @@ pub mod io;
pub mod mutex; pub mod mutex;
pub mod net; pub mod net;
pub mod os; 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"] #[path = "../unix/path.rs"]
pub mod path; pub mod path;
#[path = "../unsupported/pipe.rs"] #[path = "../unsupported/pipe.rs"]

View file

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

View file

@ -26,10 +26,6 @@ pub mod fs;
pub mod io; pub mod io;
pub mod memchr; pub mod memchr;
pub mod mutex; 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 process;
pub mod remutex; pub mod remutex;
#[macro_use] #[macro_use]