Rollup merge of #120823 - LegionMammal978:clarify-atomic-align, r=RalfJung

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.
This commit is contained in:
Matthias Krüger 2024-02-10 13:12:29 +01:00 committed by GitHub
commit 83544703f5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2119,7 +2119,16 @@ macro_rules! atomic_int {
/// This type has the same in-memory representation as the underlying /// This type has the same in-memory representation as the underlying
/// integer type, [` /// integer type, [`
#[doc = $s_int_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 /// non-atomic types as well as information about the portability of
/// this type, please see the [module-level documentation]. /// this type, please see the [module-level documentation].
/// ///