Update docs for AtomicU8/I8. · model-checking/verify-rust-std@5840184 (original) (raw)
`@@ -2091,10 +2091,10 @@ impl From<*mut T> for AtomicPtr {
`
2091
2091
`}
`
2092
2092
``
2093
2093
`#[allow(unused_macros)] // This macro ends up being unused on some architectures.
`
2094
``
`-
macro_rules! if_not_8_bit {
`
2095
``
`-
(u8, (((tt:tt)*) => { "" };
`
2096
``
`-
(i8, (((tt:tt)*) => { "" };
`
2097
``
`-
($_:ident, (((tt:tt)) => { (((tt) };
`
``
2094
`+
macro_rules! if_8_bit {
`
``
2095
`+
(u8, (yes=[( yes = [(yes=[($yes:tt)], )? (no=[( no = [(no=[($no:tt)], )? ) => { concat!("", (((($yes)*)?) };
`
``
2096
`+
(i8, (yes=[( yes = [(yes=[($yes:tt)], )? (no=[( no = [(no=[($no:tt)], )? ) => { concat!("", (((($yes)*)?) };
`
``
2097
`+
($_:ident, (yes=[( yes = [(yes=[($yes:tt)], )? (no=[( no = [(no=[($no:tt)], )? ) => { concat!("", (((($no)*)?) };
`
2098
2098
`}
`
2099
2099
``
2100
2100
`#[cfg(target_has_atomic_load_store)]
`
`@@ -2116,18 +2116,24 @@ macro_rules! atomic_int {
`
2116
2116
` inttype:identint_type:ident inttype:identatomic_type:ident) => {
`
2117
2117
`/// An integer type which can be safely shared between threads.
`
2118
2118
`///
`
2119
``
`-
/// This type has the same size and bit validity as the underlying
`
2120
``
`` -
/// integer type, [`
``
``
2119
`+
/// This type has the same
`
``
2120
`+
#[doc = if_8_bit!(
`
``
2121
`+
$int_type,
`
``
2122
`+
yes = ["size, alignment, and bit validity"],
`
``
2123
`+
no = ["size and bit validity"],
`
``
2124
`+
)]
`
``
2125
`` +
/// as the underlying integer type, [`
``
2121
2126
` #[doc = $s_int_type]
`
2122
2127
`` /// `].
``
2123
``
`-
#[doc = if_not_8_bit! {
`
``
2128
`+
#[doc = if_8_bit! {
`
2124
2129
` $int_type,
`
2125
``
`-
concat!(
`
``
2130
`+
no = [
`
2126
2131
`"However, the alignment of this type is always equal to its ",
`
2127
2132
`` "size, even on targets where [", $s_int_type, "
] has a ",
``
2128
2133
`"lesser alignment."
`
2129
``
`-
)
`
``
2134
`+
],
`
2130
2135
`}]
`
``
2136
`+
///
`
2131
2137
`/// For more about the differences between atomic types and
`
2132
2138
`/// non-atomic types as well as information about the portability of
`
2133
2139
`/// this type, please see the [module-level documentation].
`
`@@ -2220,9 +2226,19 @@ macro_rules! atomic_int {
`
2220
2226
`///
`
2221
2227
`/// # Safety
`
2222
2228
`///
`
2223
``
`` -
#[doc = concat!(" * ptr
must be aligned to \
``
2224
``
`` -
align_of::<", stringify!($atomic_type), ">()
(note that on some platforms this \
``
2225
``
`` -
can be bigger than align_of::<", stringify!($int_type), ">()
).")]
``
``
2229
`` +
/// * ptr
must be aligned to
``
``
2230
`` +
#[doc = concat!(" align_of::<", stringify!($atomic_type), ">()
")]
``
``
2231
`+
#[doc = if_8_bit!{
`
``
2232
`+
$int_type,
`
``
2233
`+
yes = [
`
``
2234
`` +
" (note that this is always true, since `align_of::<",
``
``
2235
`` +
stringify!($atomic_type), ">() == 1`)."
``
``
2236
`+
],
`
``
2237
`+
no = [
`
``
2238
`` +
" (note that on some platforms this can be bigger than `align_of::<",
``
``
2239
`` +
stringify!($int_type), ">()`)."
``
``
2240
`+
],
`
``
2241
`+
}]
`
2226
2242
`` /// * ptr
must be [valid] for both reads and writes for the whole lifetime 'a
.
``
2227
2243
`/// * You must adhere to the [Memory model for atomic accesses]. In particular, it is not
`
2228
2244
`/// allowed to mix atomic and non-atomic accesses, or atomic accesses of different sizes,
`
`@@ -2261,12 +2277,12 @@ macro_rules! atomic_int {
`
2261
2277
``
2262
2278
`` #[doc = concat!("Get atomic access to a &mut ", stringify!($int_type), "
.")]
``
2263
2279
`///
`
2264
``
`-
#[doc = if_not_8_bit! {
`
``
2280
`+
#[doc = if_8_bit! {
`
2265
2281
` $int_type,
`
2266
``
`-
concat!(
`
``
2282
`+
no = [
`
2267
2283
`` "Note: This function is only available on targets where `",
``
2268
2284
`` stringify!($int_type), "` has an alignment of ", $align, " bytes."
``
2269
``
`-
)
`
``
2285
`+
],
`
2270
2286
`}]
`
2271
2287
`///
`
2272
2288
`/// # Examples
`