Skip to content

Commit be5f070

Browse files
committed
std: move sys::pal::os to sys::paths
1 parent f4a95d3 commit be5f070

27 files changed

Lines changed: 99 additions & 255 deletions

File tree

library/std/src/env.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use crate::ffi::{OsStr, OsString};
1515
use crate::num::NonZero;
1616
use crate::ops::Try;
1717
use crate::path::{Path, PathBuf};
18-
use crate::sys::{env as env_imp, os as os_imp};
18+
use crate::sys::{env as env_imp, paths as paths_imp};
1919
use crate::{array, fmt, io, sys};
2020

2121
/// Returns the current working directory as a [`PathBuf`].
@@ -51,7 +51,7 @@ use crate::{array, fmt, io, sys};
5151
#[doc(alias = "GetCurrentDirectory")]
5252
#[stable(feature = "env", since = "1.0.0")]
5353
pub fn current_dir() -> io::Result<PathBuf> {
54-
os_imp::getcwd()
54+
paths_imp::getcwd()
5555
}
5656

5757
/// Changes the current working directory to the specified path.
@@ -78,7 +78,7 @@ pub fn current_dir() -> io::Result<PathBuf> {
7878
#[doc(alias = "chdir", alias = "SetCurrentDirectory", alias = "SetCurrentDirectoryW")]
7979
#[stable(feature = "env", since = "1.0.0")]
8080
pub fn set_current_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {
81-
os_imp::chdir(path.as_ref())
81+
paths_imp::chdir(path.as_ref())
8282
}
8383

8484
/// An iterator over a snapshot of the environment variables of this process.
@@ -444,7 +444,7 @@ pub unsafe fn remove_var<K: AsRef<OsStr>>(key: K) {
444444
#[must_use = "iterators are lazy and do nothing unless consumed"]
445445
#[stable(feature = "env", since = "1.0.0")]
446446
pub struct SplitPaths<'a> {
447-
inner: os_imp::SplitPaths<'a>,
447+
inner: paths_imp::SplitPaths<'a>,
448448
}
449449

450450
/// Parses input according to platform conventions for the `PATH`
@@ -480,7 +480,7 @@ pub struct SplitPaths<'a> {
480480
/// ```
481481
#[stable(feature = "env", since = "1.0.0")]
482482
pub fn split_paths<T: AsRef<OsStr> + ?Sized>(unparsed: &T) -> SplitPaths<'_> {
483-
SplitPaths { inner: os_imp::split_paths(unparsed.as_ref()) }
483+
SplitPaths { inner: paths_imp::split_paths(unparsed.as_ref()) }
484484
}
485485

486486
#[stable(feature = "env", since = "1.0.0")]
@@ -508,7 +508,7 @@ impl fmt::Debug for SplitPaths<'_> {
508508
#[derive(Debug)]
509509
#[stable(feature = "env", since = "1.0.0")]
510510
pub struct JoinPathsError {
511-
inner: os_imp::JoinPathsError,
511+
inner: paths_imp::JoinPathsError,
512512
}
513513

514514
/// Joins a collection of [`Path`]s appropriately for the `PATH`
@@ -579,7 +579,7 @@ where
579579
I: IntoIterator<Item = T>,
580580
T: AsRef<OsStr>,
581581
{
582-
os_imp::join_paths(paths.into_iter()).map_err(|e| JoinPathsError { inner: e })
582+
paths_imp::join_paths(paths.into_iter()).map_err(|e| JoinPathsError { inner: e })
583583
}
584584

585585
#[stable(feature = "env", since = "1.0.0")]
@@ -641,7 +641,7 @@ impl Error for JoinPathsError {
641641
#[must_use]
642642
#[stable(feature = "env", since = "1.0.0")]
643643
pub fn home_dir() -> Option<PathBuf> {
644-
os_imp::home_dir()
644+
paths_imp::home_dir()
645645
}
646646

647647
/// Returns the path of a temporary directory.
@@ -701,7 +701,7 @@ pub fn home_dir() -> Option<PathBuf> {
701701
#[doc(alias = "GetTempPath", alias = "GetTempPath2")]
702702
#[stable(feature = "env", since = "1.0.0")]
703703
pub fn temp_dir() -> PathBuf {
704-
os_imp::temp_dir()
704+
paths_imp::temp_dir()
705705
}
706706

707707
/// Returns the full filesystem path of the current running executable.
@@ -752,7 +752,7 @@ pub fn temp_dir() -> PathBuf {
752752
/// ```
753753
#[stable(feature = "env", since = "1.0.0")]
754754
pub fn current_exe() -> io::Result<PathBuf> {
755-
os_imp::current_exe()
755+
paths_imp::current_exe()
756756
}
757757

758758
/// An iterator over the arguments of a process, yielding a [`String`] value for

library/std/src/sys/args/windows.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ use crate::num::NonZero;
1212
use crate::os::windows::prelude::*;
1313
use crate::path::{Path, PathBuf};
1414
use crate::sys::helpers::WStrUnits;
15-
use crate::sys::pal::os::current_exe;
1615
use crate::sys::pal::{ensure_no_nuls, fill_utf16_buf};
1716
use crate::sys::path::get_long_path;
17+
use crate::sys::paths::current_exe;
1818
use crate::sys::{AsInner, c, to_u16s};
1919
use crate::{io, iter, ptr};
2020

library/std/src/sys/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ pub mod io;
1818
pub mod net;
1919
pub mod os_str;
2020
pub mod path;
21+
pub mod paths;
2122
pub mod pipe;
2223
pub mod platform_version;
2324
pub mod process;

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ use crate::os::raw::c_char;
2222
use crate::sys::env;
2323

2424
pub mod futex;
25-
pub mod os;
2625
pub mod time;
2726

2827
pub fn unsupported<T>() -> io::Result<T> {

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#![allow(unsafe_op_in_unsafe_fn)]
22

3-
pub mod os;
4-
53
pub use moto_rt::futex;
64

75
use crate::io;

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use crate::sync::atomic::{Atomic, AtomicBool, Ordering};
1010

1111
pub mod abi;
1212
mod libunwind_integration;
13-
pub mod os;
1413
pub mod thread_parking;
1514
pub mod waitqueue;
1615

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ pub mod itron {
1919
// `error` is `pub(crate)` so that it can be accessed by `itron/error.rs` as
2020
// `crate::sys::error`
2121
pub(crate) mod error;
22-
pub mod os;
2322
pub use self::itron::thread_parking;
2423

2524
// SAFETY: must be called only once during runtime initialization.

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#![allow(dead_code)]
88

99
pub mod conf;
10-
pub mod os;
1110
#[path = "../unix/time.rs"]
1211
pub mod time;
1312

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,5 @@
33
#[path = "../unsupported/common.rs"]
44
#[deny(unsafe_op_in_unsafe_fn)]
55
mod common;
6-
#[path = "../unsupported/os.rs"]
7-
pub mod os;
86

97
pub use common::*;

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#![forbid(unsafe_op_in_unsafe_fn)]
1515

1616
pub mod helpers;
17-
pub mod os;
1817
pub mod system_time;
1918

2019
#[cfg(test)]

0 commit comments

Comments
 (0)