Open
Description
opened on Sep 19, 2024
Feature gate: #![feature(generic_atomic)]
This is a tracking issue for replacing the distinct Atomic*
types with a generic Atomic<T>
type. This allows using Atomic
with FFI type aliases and helps clean up some API surface. Only types with existing AtomicT
are usable in Atomic<T>
.
Public API
// core::sync::atomic
pub struct Atomic<T: AtomicPrimitive>(/* private fields*/);
pub type AtomicI32 = Atomic<i32>; // etc
Steps / History
- ACP: ACP: Generic
Atomic<T>
libs-team#443 - Implement
Atomic<T>
as an alias toAtomicT
: CreateAtomic<T>
type alias #130543 - Flip alias so
AtomicT
is an alias toAtomic<T>
- Move generic functionality from
AtomicT
toAtomic<_>
- Pseudo-prerequisite: Stabilize 128-bit atomics: Tracking issue for integer_atomics #99069
- Final comment period (FCP)1
- Stabilization PR
Unresolved Questions
Atomic<T>
is soft-blocked on 128-bit atomics, because since trait implementations cannot be unstable, gatingAtomic<i128>
separately fromAtomic<i32>
isn't possible.- If necessary,
AtomicI128
could instead nameAtomic<Wrapper<i128>>
for some unstable nameWrapper
until 128-bit atomics are stable, to preventAtomic<i128>
from being usable from stable earlier than intended.
- If necessary,
Activity