Commit 071adf5
authored
Rollup merge of rust-lang#155811 - pluiee:pluiee/atomic-128-doc, r=Mark-Simulacrum
Include AtomicU128/AtomicI128 in docs for any target
Fixes rust-lang#130474
This is my first contribution, so I'll try to be as descriptive as possible of my process and thoughts.
- **Environment**: Cross compiled in Macbook M1 Air
- **Testing**: I replicated the bug and checked fixes with `./x doc library/core --target x86_64-unknown-linux-gnu` (building the std doc didn't seem to apply my local changes so I used the core doc) Check the screenshots below.
- **Diffs**: I added `#[cfg(any(...,doc))]` to all required structs and implementations so the types would compile. Applying`target_has_atomic_equal_alignment` part wasn't explicitly necessary, but adding it reveals the whole methods (specifically `from_mut` and `from_mut_slice`).
- **Thoughts**: Also wondered if additional messages should be written to notify the available targets, but the documentation already included the following sentence that seemed enough.
- **Note:** This type is only available on platforms that support atomic loads and stores of `u128`/`i128`
[Before]
<img width="988" height="233" alt="image" src="https://github.com/user-attachments/assets/e22137c2-dfc9-4239-bd0d-75c5a2e2b84f" />
[After]
<img width="988" height="281" alt="image" src="https://github.com/user-attachments/assets/8ae83cb0-46f5-4cff-a576-2183466c202f" />
---
After the first work, doc tests were failing in CI, so I added `#[$cfg_cas]` to all methods in the `atomic_int` macro to cover them. But I'm not really sure if all these changes are necessary (and appropriate).
This also has a side-effect of stating "Available on target_has_atomic=128 only." for all methods with the attribute. Also not sure if this is a good behavior..
<img width="978" height="454" alt="image" src="https://github.com/user-attachments/assets/b052f713-c8a9-4314-96be-a2832a6b84f6" />1 file changed
Lines changed: 109 additions & 71 deletions
0 commit comments