diff options
| author | Ralf Jung <post@ralfj.de> | 2025-01-15 08:39:35 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-15 08:39:35 +0000 |
| commit | 5460fbe610cacae6de98a3dfc3ffe9573f0c9906 (patch) | |
| tree | 96bea23fabeb42d05f67dbb77d59f152a7e9f18d /library/std/src/path.rs | |
| parent | d40f2f77bf372b0ce5fc16000c6ec1b95bd654c0 (diff) | |
| parent | 0930bfe6d29a2c9b5b71219ff4c946b732d3f3c7 (diff) | |
Merge pull request #4139 from rust-lang/rustup-2025-01-15
Automatic Rustup
Diffstat (limited to 'library/std/src/path.rs')
| -rw-r--r-- | library/std/src/path.rs | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/library/std/src/path.rs b/library/std/src/path.rs index 35e920ab344..7fd08a97f1f 100644 --- a/library/std/src/path.rs +++ b/library/std/src/path.rs @@ -298,7 +298,7 @@ where } // Detect scheme on Redox -fn has_redox_scheme(s: &[u8]) -> bool { +pub(crate) fn has_redox_scheme(s: &[u8]) -> bool { cfg!(target_os = "redox") && s.contains(&b':') } @@ -2155,7 +2155,7 @@ impl Path { unsafe { Path::new(OsStr::from_encoded_bytes_unchecked(s)) } } // The following (private!) function reveals the byte encoding used for OsStr. - fn as_u8_slice(&self) -> &[u8] { + pub(crate) fn as_u8_slice(&self) -> &[u8] { self.inner.as_encoded_bytes() } @@ -2323,14 +2323,7 @@ impl Path { #[must_use] #[allow(deprecated)] pub fn is_absolute(&self) -> bool { - if cfg!(target_os = "redox") { - // FIXME: Allow Redox prefixes - self.has_root() || has_redox_scheme(self.as_u8_slice()) - } else { - self.has_root() - && (cfg!(any(unix, target_os = "hermit", target_os = "wasi")) - || self.prefix().is_some()) - } + sys::path::is_absolute(self) } /// Returns `true` if the `Path` is relative, i.e., not absolute. @@ -2353,7 +2346,7 @@ impl Path { !self.is_absolute() } - fn prefix(&self) -> Option<Prefix<'_>> { + pub(crate) fn prefix(&self) -> Option<Prefix<'_>> { self.components().prefix } |
