Skip to content

Commit

Permalink
Update safety docs for AtomicBool::from_ptr.
Browse files Browse the repository at this point in the history
Clarify that alignment is never an issue, since `align_of::<AtomicBool>() == 1`.
  • Loading branch information
zachs18 committed Jun 10, 2024
1 parent a70b2ae commit 7885c7b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions library/core/src/sync/atomic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -443,8 +443,8 @@ impl AtomicBool {
///
/// # Safety
///
/// * `ptr` must be aligned to `align_of::<AtomicBool>()` (note that on some platforms this can
/// be bigger than `align_of::<bool>()`).
/// * `ptr` must be aligned to `align_of::<AtomicBool>()` (note that this is always true, since
/// `align_of::<AtomicBool>() == 1`).
/// * `ptr` must be [valid] for both reads and writes for the whole lifetime `'a`.
/// * You must adhere to the [Memory model for atomic accesses]. In particular, it is not
/// allowed to mix atomic and non-atomic accesses, or atomic accesses of different sizes,
Expand Down

0 comments on commit 7885c7b

Please sign in to comment.