Skip to content

Commit 7885c7b

Browse files
committed
Update safety docs for AtomicBool::from_ptr.
Clarify that alignment is never an issue, since `align_of::<AtomicBool>() == 1`.
1 parent a70b2ae commit 7885c7b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

library/core/src/sync/atomic.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -443,8 +443,8 @@ impl AtomicBool {
443443
///
444444
/// # Safety
445445
///
446-
/// * `ptr` must be aligned to `align_of::<AtomicBool>()` (note that on some platforms this can
447-
/// be bigger than `align_of::<bool>()`).
446+
/// * `ptr` must be aligned to `align_of::<AtomicBool>()` (note that this is always true, since
447+
/// `align_of::<AtomicBool>() == 1`).
448448
/// * `ptr` must be [valid] for both reads and writes for the whole lifetime `'a`.
449449
/// * You must adhere to the [Memory model for atomic accesses]. In particular, it is not
450450
/// allowed to mix atomic and non-atomic accesses, or atomic accesses of different sizes,

0 commit comments

Comments
 (0)