diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:57:31 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:57:31 +0000 |
commit | dc0db358abe19481e475e10c32149b53370f1a1c (patch) | |
tree | ab8ce99c4b255ce46f99ef402c27916055b899ee /vendor/rustix/src/path/arg.rs | |
parent | Releasing progress-linux version 1.71.1+dfsg1-2~progress7.99u1. (diff) | |
download | rustc-dc0db358abe19481e475e10c32149b53370f1a1c.tar.xz rustc-dc0db358abe19481e475e10c32149b53370f1a1c.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/arg.rs')
-rw-r--r-- | vendor/rustix/src/path/arg.rs | 18 |
1 files changed, 7 insertions, 11 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); |