summaryrefslogtreecommitdiffstats
path: root/vendor/rustix/src/path
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:19 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:57:19 +0000
commita0b8f38ab54ac451646aa00cd5e91b6c76f22a84 (patch)
treefc451898ccaf445814e26b46664d78702178101d /vendor/rustix/src/path
parentAdding debian version 1.71.1+dfsg1-2. (diff)
downloadrustc-a0b8f38ab54ac451646aa00cd5e91b6c76f22a84.tar.xz
rustc-a0b8f38ab54ac451646aa00cd5e91b6c76f22a84.zip
Merging upstream version 1.72.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/rustix/src/path')
-rw-r--r--vendor/rustix/src/path/arg.rs18
-rw-r--r--vendor/rustix/src/path/dec_int.rs16
-rw-r--r--vendor/rustix/src/path/mod.rs1
3 files changed, 13 insertions, 22 deletions
diff --git a/vendor/rustix/src/path/arg.rs b/vendor/rustix/src/path/arg.rs
index b6b2a8a73..64091611c 100644
--- a/vendor/rustix/src/path/arg.rs
+++ b/vendor/rustix/src/path/arg.rs
@@ -19,17 +19,13 @@ use core::mem::MaybeUninit;
use core::{ptr, slice, str};
#[cfg(feature = "std")]
use std::ffi::{OsStr, OsString};
-#[cfg(feature = "std")]
-#[cfg(target_os = "hermit")]
+#[cfg(all(feature = "std", target_os = "hermit"))]
use std::os::hermit::ext::ffi::{OsStrExt, OsStringExt};
-#[cfg(feature = "std")]
-#[cfg(unix)]
+#[cfg(all(feature = "std", unix))]
use std::os::unix::ffi::{OsStrExt, OsStringExt};
-#[cfg(feature = "std")]
-#[cfg(target_os = "vxworks")]
+#[cfg(all(feature = "std", target_os = "vxworks"))]
use std::os::vxworks::ext::ffi::{OsStrExt, OsStringExt};
-#[cfg(feature = "std")]
-#[cfg(target_os = "wasi")]
+#[cfg(all(feature = "std", target_os = "wasi"))]
use std::os::wasi::ffi::{OsStrExt, OsStringExt};
#[cfg(feature = "std")]
use std::path::{Component, Components, Iter, Path, PathBuf};
@@ -952,13 +948,13 @@ where
// Taken from
// <https://github.com/rust-lang/rust/blob/a00f8ba7fcac1b27341679c51bf5a3271fa82df3/library/std/src/sys/common/small_c_string.rs>
let mut buf = MaybeUninit::<[u8; SMALL_PATH_BUFFER_SIZE]>::uninit();
- let buf_ptr = buf.as_mut_ptr() as *mut u8;
+ let buf_ptr = buf.as_mut_ptr().cast::<u8>();
// This helps test our safety condition below.
debug_assert!(bytes.len() + 1 <= SMALL_PATH_BUFFER_SIZE);
- // SAFETY: `bytes.len() < SMALL_PATH_BUFFER_SIZE` which means we have space for
- // `bytes.len() + 1` u8s:
+ // SAFETY: `bytes.len() < SMALL_PATH_BUFFER_SIZE` which means we have space
+ // for `bytes.len() + 1` u8s:
unsafe {
ptr::copy_nonoverlapping(bytes.as_ptr(), buf_ptr, bytes.len());
buf_ptr.add(bytes.len()).write(0);
diff --git a/vendor/rustix/src/path/dec_int.rs b/vendor/rustix/src/path/dec_int.rs
index 5ba8be4fc..04c97d406 100644
--- a/vendor/rustix/src/path/dec_int.rs
+++ b/vendor/rustix/src/path/dec_int.rs
@@ -8,20 +8,14 @@
use crate::backend::fd::{AsFd, AsRawFd};
use crate::ffi::CStr;
-#[cfg(feature = "std")]
-use core::fmt;
use core::fmt::Write;
use itoa::{Buffer, Integer};
-#[cfg(feature = "std")]
-use std::ffi::OsStr;
-#[cfg(feature = "std")]
-#[cfg(unix)]
+#[cfg(all(feature = "std", unix))]
use std::os::unix::ffi::OsStrExt;
-#[cfg(feature = "std")]
-#[cfg(target_os = "wasi")]
+#[cfg(all(feature = "std", target_os = "wasi"))]
use std::os::wasi::ffi::OsStrExt;
#[cfg(feature = "std")]
-use std::path::Path;
+use {core::fmt, std::ffi::OsStr, std::path::Path};
/// Format an integer into a decimal `Path` component, without constructing a
/// temporary `PathBuf` or `String`.
@@ -31,10 +25,10 @@ use std::path::Path;
/// # Example
///
/// ```
-/// # #[cfg(feature = "path")]
+/// # #[cfg(any(feature = "fs", feature = "net"))]
/// use rustix::path::DecInt;
///
-/// # #[cfg(feature = "path")]
+/// # #[cfg(any(feature = "fs", feature = "net"))]
/// assert_eq!(
/// format!("hello {}", DecInt::new(9876).as_ref().display()),
/// "hello 9876"
diff --git a/vendor/rustix/src/path/mod.rs b/vendor/rustix/src/path/mod.rs
index bd6e9fc8b..19bf2c7f0 100644
--- a/vendor/rustix/src/path/mod.rs
+++ b/vendor/rustix/src/path/mod.rs
@@ -6,6 +6,7 @@ mod dec_int;
pub use arg::Arg;
#[cfg(feature = "itoa")]
+#[cfg_attr(doc_cfg, doc(cfg(feature = "itoa")))]
pub use dec_int::DecInt;
pub(crate) const SMALL_PATH_BUFFER_SIZE: usize = 256;