Skip to content

Commit 434f080

Browse files
authored
Rollup merge of #120776 - joboet:move_pal_path, r=ChrisDenton
Move path implementations into `sys` Part of #117276. r? `@ChrisDenton`
2 parents 99bafad + c0d9776 commit 434f080

File tree

21 files changed

+24
-51
lines changed

21 files changed

+24
-51
lines changed

library/std/src/sys/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ mod personality;
77

88
pub mod cmath;
99
pub mod os_str;
10+
pub mod path;
1011

1112
// FIXME(117276): remove this, move feature implementations into individual
1213
// submodules.

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

-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ pub mod io;
2828
pub mod memchr;
2929
pub mod net;
3030
pub mod os;
31-
#[path = "../unix/path.rs"]
32-
pub mod path;
3331
#[path = "../unsupported/pipe.rs"]
3432
pub mod pipe;
3533
#[path = "../unsupported/process.rs"]

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

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ pub mod io;
2222
pub mod memchr;
2323
pub mod net;
2424
pub mod os;
25-
pub mod path;
2625
#[path = "../unsupported/pipe.rs"]
2726
pub mod pipe;
2827
#[path = "../unsupported/process.rs"]

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

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ pub mod fs;
2929
pub mod io;
3030
pub mod net;
3131
pub mod os;
32-
pub mod path;
3332
#[path = "../unsupported/pipe.rs"]
3433
pub mod pipe;
3534
#[path = "../unsupported/process.rs"]

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

-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ pub mod net;
2525
#[path = "../unsupported/once.rs"]
2626
pub mod once;
2727
pub mod os;
28-
#[path = "../unix/path.rs"]
29-
pub mod path;
3028
#[path = "../unsupported/pipe.rs"]
3129
pub mod pipe;
3230
#[path = "../unsupported/process.rs"]

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

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ pub mod net;
2626
#[path = "../unsupported/once.rs"]
2727
pub mod once;
2828
pub mod os;
29-
pub mod path;
3029
#[path = "../unsupported/pipe.rs"]
3130
pub mod pipe;
3231
#[path = "../unsupported/process.rs"]

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

-25
This file was deleted.

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

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ pub mod net;
2727
#[cfg(target_os = "l4re")]
2828
pub use self::l4re::net;
2929
pub mod os;
30-
pub mod path;
3130
pub mod pipe;
3231
pub mod process;
3332
pub mod rand;

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

-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ pub mod locks;
99
pub mod net;
1010
pub mod once;
1111
pub mod os;
12-
#[path = "../unix/path.rs"]
13-
pub mod path;
1412
pub mod pipe;
1513
pub mod process;
1614
pub mod stdio;

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

-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ pub mod io;
3030

3131
pub mod net;
3232
pub mod os;
33-
#[path = "../unix/path.rs"]
34-
pub mod path;
3533
#[path = "../unsupported/pipe.rs"]
3634
pub mod pipe;
3735
#[path = "../unsupported/process.rs"]

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

-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ pub mod io;
2828
pub mod net;
2929
#[path = "../unsupported/os.rs"]
3030
pub mod os;
31-
#[path = "../unix/path.rs"]
32-
pub mod path;
3331
#[path = "../unsupported/pipe.rs"]
3432
pub mod pipe;
3533
#[path = "../unsupported/process.rs"]

library/std/src/sys/pal/windows/fs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ use crate::sys::{c, cvt, Align8};
1616
use crate::sys_common::{AsInner, FromInner, IntoInner};
1717
use crate::thread;
1818

19-
use super::path::maybe_verbatim;
2019
use super::{api, to_u16s, IoResult};
20+
use crate::sys::path::maybe_verbatim;
2121

2222
pub struct File {
2323
handle: Handle,

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

+2-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ pub mod locks;
2323
pub mod memchr;
2424
pub mod net;
2525
pub mod os;
26-
pub mod path;
2726
pub mod pipe;
2827
pub mod process;
2928
pub mod rand;
@@ -210,7 +209,7 @@ pub fn to_u16s<S: AsRef<OsStr>>(s: S) -> crate::io::Result<Vec<u16>> {
210209
// Once the syscall has completed (errors bail out early) the second closure is
211210
// yielded the data which has been read from the syscall. The return value
212211
// from this closure is then the return value of the function.
213-
fn fill_utf16_buf<F1, F2, T>(mut f1: F1, f2: F2) -> crate::io::Result<T>
212+
pub fn fill_utf16_buf<F1, F2, T>(mut f1: F1, f2: F2) -> crate::io::Result<T>
214213
where
215214
F1: FnMut(*mut u16, c::DWORD) -> c::DWORD,
216215
F2: FnOnce(&[u16]) -> T,
@@ -274,7 +273,7 @@ where
274273
}
275274
}
276275

277-
fn os2path(s: &[u16]) -> PathBuf {
276+
pub fn os2path(s: &[u16]) -> PathBuf {
278277
PathBuf::from(OsString::from_wide(s))
279278
}
280279

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

-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ pub mod io;
1212
pub mod locks;
1313
pub mod net;
1414
pub mod os;
15-
#[path = "../unix/path.rs"]
16-
pub mod path;
1715
#[path = "../unsupported/pipe.rs"]
1816
pub mod pipe;
1917
#[path = "../unsupported/process.rs"]

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

-4
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ pub mod net;
2424
#[path = "../unsupported/once.rs"]
2525
pub mod once;
2626
pub mod os;
27-
#[path = "../unix/os_str.rs"]
28-
pub mod os_str;
29-
#[path = "../unix/path.rs"]
30-
pub mod path;
3127
#[path = "../unsupported/pipe.rs"]
3228
pub mod pipe;
3329
#[path = "../unsupported/process.rs"]

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

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
cfg_if::cfg_if! {
2+
if #[cfg(target_os = "windows")] {
3+
mod windows;
4+
pub use windows::*;
5+
} else if #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] {
6+
mod sgx;
7+
pub use sgx::*;
8+
} else if #[cfg(any(
9+
target_os = "uefi",
10+
target_os = "solid_asp3",
11+
))] {
12+
mod unsupported_backslash;
13+
pub use unsupported_backslash::*;
14+
} else {
15+
mod unix;
16+
pub use unix::*;
17+
}
18+
}
File renamed without changes.
File renamed without changes.

library/std/src/sys/pal/windows/path.rs library/std/src/sys/path/windows.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
use super::{c, fill_utf16_buf, to_u16s};
21
use crate::ffi::{OsStr, OsString};
32
use crate::io;
43
use crate::path::{Path, PathBuf, Prefix};
54
use crate::ptr;
5+
use crate::sys::pal::{c, fill_utf16_buf, os2path, to_u16s};
66

77
#[cfg(test)]
88
mod tests;
@@ -339,6 +339,6 @@ pub(crate) fn absolute(path: &Path) -> io::Result<PathBuf> {
339339
// `lpfilename` is a pointer to a null terminated string that is not
340340
// invalidated until after `GetFullPathNameW` returns successfully.
341341
|buffer, size| unsafe { c::GetFullPathNameW(lpfilename, size, buffer, ptr::null_mut()) },
342-
super::os2path,
342+
os2path,
343343
)
344344
}

0 commit comments

Comments
 (0)