Skip to content

Tracking Issue for generic Atomic #130539

Open
@CAD97

Description

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

Unresolved Questions

  • Atomic<T> is soft-blocked on 128-bit atomics, because since trait implementations cannot be unstable, gating Atomic<i128> separately from Atomic<i32> isn't possible.
    • If necessary, AtomicI128 could instead name Atomic<Wrapper<i128>> for some unstable name Wrapper until 128-bit atomics are stable, to prevent Atomic<i128> from being usable from stable earlier than intended.

Footnotes

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions