Include AtomicU128/AtomicI128 in docs for any target#155811
Conversation
This comment has been minimized.
This comment has been minimized.
cbcafea to
6e7e00b
Compare
|
rustbot has assigned @Mark-Simulacrum. Use Why was this reviewer chosen?The reviewer was selected based on:
|
Hm, can you say more about the failure you were seeing? I suspect we were trying to run doc tests for AtomicU128 which indeed doesn't make sense if the target doesn't have u128 atomics... but I'd have expected that if the cfg is needed to avoid that we would have already hit the same problem for platforms that don't have the full set of atomic types. Maybe only a subset of the tests were failing? |
|
The failure mentioned in the previous PR is exactly the behavior I saw after adding
As far as I understand, this is a unique case where we want to expose a type in the docs that isn't actually supported, because the official docs are built for a specific target ( |
|
☔ The latest upstream changes (presumably #156720) made this pull request unmergeable. Please resolve the merge conflicts. |
Fixes #130474
This is my first contribution, so I'll try to be as descriptive as possible of my process and thoughts.
./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.#[cfg(any(...,doc))]to all required structs and implementations so the types would compile. Applyingtarget_has_atomic_equal_alignmentpart wasn't explicitly necessary, but adding it reveals the whole methods (specificallyfrom_mutandfrom_mut_slice).u128/i128[Before]

[After]

After the first work, doc tests were failing in CI, so I added

#[$cfg_cas]to all methods in theatomic_intmacro 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..