Create `Atomic<T>` type alias by CAD97 · Pull Request #130543 · rust-lang/rust

@rustbot rustbot added O-hermit

Operating System: Hermit

O-itron

Operating System: ITRON

O-SGX

Target: SGX

O-unix

Operating system: Unix-like

O-wasm

Target: WASM (WebAssembly), http://webassembly.org/

O-windows

Operating system: Windows

S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

T-libs

Relevant to the library team, which will review and decide on the PR/issue.

labels

Sep 19, 2024

@CAD97 CAD97 mentioned this pull request

Sep 19, 2024

7 tasks

CAD97

Noratrieb

@bors bors added S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

and removed S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

labels

Sep 19, 2024

workingjubilee added a commit to workingjubilee/rustc that referenced this pull request

Sep 19, 2024
Create `Atomic<T>` type alias

and use it in core/alloc/std where possible, ignoring test files for now.

This is step one, creating the alias from `Atomic<T>` to `AtomicT`. The next step of flipping this and aliasing `AtomicT` to `Atomic<T>` will have a bigger impact, since `AtomicT` imports can be dropped once `Atomic::new` is a usable name.

First commit is the true change. Second commit is mostly mechanical replacement of `AtomicT` type names with `Atomic<T>`.

See [how this was done for `NonZero`](rust-lang#120257) for the rough blueprint I'm following.

- ACP: rust-lang/libs-team#443 (comment)
- Tracking issue: rust-lang#130539

@ojeda ojeda mentioned this pull request

Sep 19, 2024

19 tasks

@CAD97 @GrigorenkoPV

in core/alloc/std only for now, and ignoring test files

Co-authored-by: Pavel Grigorenko <GrigorenkoPV@ya.ru>

@rustbot rustbot added S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

and removed S-waiting-on-author

Status: This is awaiting some action (such as code changes or more information) from the author.

labels

Feb 1, 2025

@bors bors added S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

and removed S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

labels

Feb 5, 2025

bors added a commit to rust-lang-ci/rust that referenced this pull request

Feb 6, 2025
Create `Atomic<T>` type alias

and use it in core/alloc/std where possible, ignoring test files for now.

This is step one, creating the alias from `Atomic<T>` to `AtomicT`. The next step of flipping this and aliasing `AtomicT` to `Atomic<T>` will have a bigger impact, since `AtomicT` imports can be dropped once `Atomic::new` is a usable name.

First commit is the true change. Second commit is mostly mechanical replacement of `AtomicT` type names with `Atomic<T>`.

See [how this was done for `NonZero`](rust-lang#120257) for the rough blueprint I'm following.

- ACP: rust-lang/libs-team#443 (comment)
- Tracking issue: rust-lang#130539

@bors bors added S-waiting-on-author

Status: This is awaiting some action (such as code changes or more information) from the author.

and removed S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

labels

Feb 6, 2025

@bors bors added S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

and removed S-waiting-on-author

Status: This is awaiting some action (such as code changes or more information) from the author.

labels

Feb 6, 2025

@rustbot rustbot added S-waiting-on-author

Status: This is awaiting some action (such as code changes or more information) from the author.

and removed S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

labels

Feb 6, 2025

github-merge-queue bot pushed a commit to rust-lang/rust-clippy that referenced this pull request

Feb 11, 2025
…solve `<T as Trait>::AssocT` projections (#14125)

changelog: [`declare_interior_mutable_const`,
`borrow_interior_mutable_const`]: resolve `<T as Trait>::AssocT`
projections

---

This came up during rust-lang/rust#130543 where
we have `<T as AtomicPrimitive>::Assoc = AtomicT` instead of just
`AtomicT` and clippy failed to resolve that properly.

This really needs a review, because

- I don't know if `try_normalize_erasing_regions` is the right thing to
call here.
- I'm not sure if I peel off the correct amount of `ValTree::Branch`
layers (I think I do).

Also, shouldn't this lint's infrastructure rely on `Freeze` trait
(rust-lang/rust#121675) instead of hardcoding
a list of known-to-be-interior-mutable types?

---

Previously filed this in the main rust repo
(rust-lang/rust#136369), was asked to do it here
instead
(rust-lang/rust#136369 (comment)).

bors added a commit to rust-lang-ci/rust that referenced this pull request

Apr 20, 2025
…Simulacrum

 Create `Atomic<T>` type alias (rebase)

Rebase of rust-lang#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 rust-lang/rust-clippy#14125

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

---

* ACP: rust-lang/libs-team#443 (comment)
* Tracking issue: rust-lang#130539

bors added a commit to rust-lang-ci/rust that referenced this pull request

Apr 28, 2025
…Simulacrum

 Create `Atomic<T>` type alias (rebase)

Rebase of rust-lang#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 rust-lang/rust-clippy#14125

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

---

* ACP: rust-lang/libs-team#443 (comment)
* Tracking issue: rust-lang#130539

github-actions bot pushed a commit to model-checking/verify-rust-std that referenced this pull request

May 9, 2025
…Simulacrum

 Create `Atomic<T>` type alias (rebase)

Rebase of rust-lang#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 rust-lang/rust-clippy#14125

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

---

* ACP: rust-lang/libs-team#443 (comment)
* Tracking issue: rust-lang#130539