Skip to content

Commit a1b41a9

Browse files
authored
Rollup merge of #119996 - joboet:move_pal_os_str, r=ChrisDenton
Move OS String implementation into `sys` Part of #117276. The new structure is really useful here, since we can easily eliminate a number of ugly `#[path]`-based imports. In the future, it might be good to move the WTF-8 implementation directly to the OS string implementation, I cannot see it being used anywhere else. That is a story for another PR, however.
2 parents 203cc69 + 70b0364 commit a1b41a9

File tree

16 files changed

+13
-21
lines changed

16 files changed

+13
-21
lines changed

library/std/src/sys/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
/// descriptors.
44
mod pal;
55

6+
pub mod os_str;
67
mod personality;
78

89
// FIXME(117276): remove this, move feature implementations into individual

library/std/src/sys/pal/unix/os_str.rs renamed to library/std/src/sys/os_str/bytes.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use crate::sys_common::{AsInner, IntoInner};
1414
use core::str::Utf8Chunks;
1515

1616
#[cfg(test)]
17-
#[path = "../unix/os_str/tests.rs"]
1817
mod tests;
1918

2019
#[derive(Hash)]

library/std/src/sys/os_str/mod.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
cfg_if::cfg_if! {
2+
if #[cfg(any(
3+
target_os = "windows",
4+
target_os = "uefi",
5+
))] {
6+
mod wtf8;
7+
pub use wtf8::{Buf, Slice};
8+
} else {
9+
mod bytes;
10+
pub use bytes::{Buf, Slice};
11+
}
12+
}

library/std/src/sys/pal/hermit/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ pub mod io;
3030
pub mod memchr;
3131
pub mod net;
3232
pub mod os;
33-
#[path = "../unix/os_str.rs"]
34-
pub mod os_str;
3533
#[path = "../unix/path.rs"]
3634
pub mod path;
3735
#[path = "../unsupported/pipe.rs"]

library/std/src/sys/pal/sgx/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ pub mod io;
2424
pub mod memchr;
2525
pub mod net;
2626
pub mod os;
27-
#[path = "../unix/os_str.rs"]
28-
pub mod os_str;
2927
pub mod path;
3028
#[path = "../unsupported/pipe.rs"]
3129
pub mod pipe;

library/std/src/sys/pal/solid/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ pub mod fs;
3131
pub mod io;
3232
pub mod net;
3333
pub mod os;
34-
#[path = "../unix/os_str.rs"]
35-
pub mod os_str;
3634
pub mod path;
3735
#[path = "../unsupported/pipe.rs"]
3836
pub mod pipe;

library/std/src/sys/pal/teeos/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ pub mod net;
2727
#[path = "../unsupported/once.rs"]
2828
pub mod once;
2929
pub mod os;
30-
#[path = "../unix/os_str.rs"]
31-
pub mod os_str;
3230
#[path = "../unix/path.rs"]
3331
pub mod path;
3432
#[path = "../unsupported/pipe.rs"]

library/std/src/sys/pal/uefi/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ pub mod net;
2828
#[path = "../unsupported/once.rs"]
2929
pub mod once;
3030
pub mod os;
31-
#[path = "../windows/os_str.rs"]
32-
pub mod os_str;
3331
pub mod path;
3432
#[path = "../unsupported/pipe.rs"]
3533
pub mod pipe;

0 commit comments

Comments
 (0)