about summary refs log tree commit diff
path: root/library/std/src/sys/process
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-04-28 05:12:59 +0000
committerbors <bors@rust-lang.org>2025-04-28 05:12:59 +0000
commit0134651fb81314870903e21b1bcbdd993d75b61a (patch)
treeb912264968f9c6956b72422437f29c9dae64b14d /library/std/src/sys/process
parent21079f53a359d9fc82668d4175d49dafdb600563 (diff)
parentdf3dd876c95f4dcf83a80c33fe9b5a59df78de45 (diff)
Auto merge of #136316 - GrigorenkoPV:generic_atomic, r=Mark-Simulacrum
 Create `Atomic<T>` type alias (rebase)

Rebase of #130543.

Additional changes:
- Switch from `allow` to `expect` for `private_bounds` on `AtomicPrimitive`
- Unhide `AtomicPrimitive::AtomicInner` from docs, because rustdoc shows the definition `pub type Atomic<T> = <T as AtomicPrimitive>::AtomicInner;` and generated links for it.
  - `NonZero` did not have this issue, because they kept the new alias private before the direction was changed.
- Use `Atomic<_>` in more places, including inside `Once`'s `Futex`. This is possible thanks to https://github.com/rust-lang/rust-clippy/pull/14125

The rest will either get moved back to #130543 or #130543 will be closed in favor of this instead.

---

* ACP: https://github.com/rust-lang/libs-team/issues/443#event-14293381061
* Tracking issue: #130539
Diffstat (limited to 'library/std/src/sys/process')
-rw-r--r--library/std/src/sys/process/unix/unix.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/library/std/src/sys/process/unix/unix.rs b/library/std/src/sys/process/unix/unix.rs
index 478f6583b1f..ae1c9558281 100644
--- a/library/std/src/sys/process/unix/unix.rs
+++ b/library/std/src/sys/process/unix/unix.rs
@@ -442,7 +442,7 @@ impl Command {
         envp: Option<&CStringArray>,
     ) -> io::Result<Option<Process>> {
         #[cfg(target_os = "linux")]
-        use core::sync::atomic::{AtomicU8, Ordering};
+        use core::sync::atomic::{Atomic, AtomicU8, Ordering};
 
         use crate::mem::MaybeUninit;
         use crate::sys::{self, cvt_nz, on_broken_pipe_flag_used};
@@ -475,7 +475,7 @@ impl Command {
                     fn pidfd_getpid(pidfd: libc::c_int) -> libc::c_int;
                 );
 
-                static PIDFD_SUPPORTED: AtomicU8 = AtomicU8::new(0);
+                static PIDFD_SUPPORTED: Atomic<u8> = AtomicU8::new(0);
                 const UNKNOWN: u8 = 0;
                 const SPAWN: u8 = 1;
                 // Obtaining a pidfd via the fork+exec path might work