diff options
| author | LegionMammal978 <mattlloydhouse@gmail.com> | 2024-02-08 22:59:36 -0500 |
|---|---|---|
| committer | LegionMammal978 <mattlloydhouse@gmail.com> | 2024-02-08 22:59:36 -0500 |
| commit | c94bbb24db36726a2931ae9df114581b2e76f283 (patch) | |
| tree | 5852de713a9c97da13ee43bed78e1698a68510bd | |
| parent | 98aa3624be70462d6a25ed5544333e3df62f4c66 (diff) | |
| download | rust-c94bbb24db36726a2931ae9df114581b2e76f283.tar.gz rust-c94bbb24db36726a2931ae9df114581b2e76f283.zip | |
Clarify that atomic and regular integers can differ in alignment
The documentation for atomic integers says that they have the "same in-memory representation" as their underlying integers. This might be misconstrued as implying that they have the same layout. Therefore, clarify that atomic integers' alignment is equal to their size.
| -rw-r--r-- | library/core/src/sync/atomic.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/library/core/src/sync/atomic.rs b/library/core/src/sync/atomic.rs index ad8c70c6a3c..d9654973b84 100644 --- a/library/core/src/sync/atomic.rs +++ b/library/core/src/sync/atomic.rs @@ -2119,7 +2119,16 @@ macro_rules! atomic_int { /// This type has the same in-memory representation as the underlying /// integer type, [` #[doc = $s_int_type] - /// `]. For more about the differences between atomic types and + /// `]. + #[doc = if_not_8_bit! { + $int_type, + concat!( + "However, the alignment of this type is always equal to its ", + "size, even on targets where [`", $s_int_type, "`] has a ", + "lesser alignment." + ) + }] + /// For more about the differences between atomic types and /// non-atomic types as well as information about the portability of /// this type, please see the [module-level documentation]. /// |
