about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-06-24 15:06:21 +0200
committerGitHub <noreply@github.com>2024-06-24 15:06:21 +0200
commit94b9ea417dcce52b3600e8840547a6d7ec9a6891 (patch)
treeed20f3856b8ed259b6bfc0ffef8b002ecc9d2e5a /compiler/rustc_resolve/src
parent9d24ecc37b206ca73e427ba8c7f17f35d5c5817b (diff)
parent2d4cb7aa5ae86a7fca57d80e7a0d6acdf79fa64e (diff)
downloadrust-94b9ea417dcce52b3600e8840547a6d7ec9a6891.tar.gz
rust-94b9ea417dcce52b3600e8840547a6d7ec9a6891.zip
Rollup merge of #126213 - zachs18:atomicbool-u8-i8-from-ptr-alignment, r=Nilstrieb
Update docs for AtomicBool/U8/I8 with regard to alignment

Fixes #126084.

Since `AtomicBool`/`AtomicU8`/`AtomicI8` are guaranteed to have size == 1, and Rust guarantees that `size % align == 0`, they also must have alignment equal to 1, so some current docs are contradictory/confusing when describing their alignment requirements.

Specifically:

* Fix `AtomicBool::from_ptr` claiming that `align_of::<AtomicBool>() > align_of::<bool>()` on some platforms. (same for `AtomicU8::from_ptr`/`AtomicI8::from_ptr`)
* Explicitly state that `AtomicU8`/`AtomicI8` have the same alignment as `u8`/`i8` (in addition to size and bit validity)
* (internal) Change the `if_not_8_bit` macro to be `if_8_bit` and to allow an "if-else"-like structure, instead of just "if"-like.

---

I opted to leave the "`ptr` must be aligned" wording in `from_ptr`'s docs and just clarify that it is always satsified, instead of just removing the wording entirely. If that is instead preferred I can do that.
Diffstat (limited to 'compiler/rustc_resolve/src')
0 files changed, 0 insertions, 0 deletions