Skip to content

Commit 80cb937

Browse files
committed
docs: enhance wording
1 parent 282f2d0 commit 80cb937

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

library/core/src/ptr/mod.rs

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1769,15 +1769,14 @@ pub const unsafe fn write_unaligned<T>(dst: *mut T, src: T) {
17691769
/// behave exactly like non-atomic accesses in that regard.
17701770
///
17711771
/// - Volatile operations, however, may also be used to access memory that is _outside_ of any Rust
1772-
/// allocation. In this use-case, the pointer does *not* have to be [valid] for reads. The main
1773-
/// usage is CPU and peripheral registers that must be accessed via an I/O memory mapping, most
1774-
/// commonly at fixed addresses reserved by the hardware. These often have special semantics
1775-
/// associated to their manipulation, and cannot be used as general purpose memory. Here, any
1776-
/// address value is possible, including 0 and [`usize::MAX`], so long as the semantics of such a
1777-
/// read are well-defined by the target hardware. The access must not trap. It can (and usually
1778-
/// will) cause side-effects, but those must not affect Rust-allocated memory in in any way. This
1779-
/// access is still not considered [atomic], and as such it cannot be used for inter-thread
1780-
/// synchronization.
1772+
/// allocation. In this use-case, the pointer does *not* have to be [valid] for reads. This is
1773+
/// typically used for CPU and peripheral registers that must be accessed via an I/O memory
1774+
/// mapping, most commonly at fixed addresses reserved by the hardware. These often have special
1775+
/// semantics associated to their manipulation, and cannot be used as general purpose memory.
1776+
/// Here, any address value is possible, including 0 and [`usize::MAX`], so long as the semantics
1777+
/// of such a read are well-defined by the target hardware. The access must not trap. It can cause
1778+
/// side-effects, but those must not affect Rust-allocated memory in in any way. This access is
1779+
/// still not considered [atomic], and as such it cannot be used for inter-thread synchronization.
17811780
///
17821781
/// Note that volatile memory operations on zero-sized types (e.g., if a zero-sized type is passed
17831782
/// to `read_volatile`) are noops and may be ignored.
@@ -1861,15 +1860,14 @@ pub unsafe fn read_volatile<T>(src: *const T) -> T {
18611860
/// behave exactly like non-atomic accesses in that regard.
18621861
///
18631862
/// - Volatile operations, however, may also be used to access memory that is _outside_ of any Rust
1864-
/// allocation. In this use-case, the pointer does *not* have to be [valid] for writes. The main
1865-
/// usage is CPU and peripheral registers that must be accessed via an I/O memory mapping, most
1866-
/// commonly at fixed addresses reserved by the hardware. These often have special semantics
1867-
/// associated to their manipulation, and cannot be used as general purpose memory. Here, any
1868-
/// address value is possible, including 0 and [`usize::MAX`], so long as the semantics of such a
1869-
/// write are well-defined by the target hardware. The access must not trap. It can (and usually
1870-
/// will) cause side-effects, but those must not affect Rust-allocated memory in any way. This
1871-
/// access is still not considered [atomic], and as such it cannot be used for inter-thread
1872-
/// synchronization.
1863+
/// allocation. In this use-case, the pointer does *not* have to be [valid] for writes. This is
1864+
/// typically used for CPU and peripheral registers that must be accessed via an I/O memory
1865+
/// mapping, most commonly at fixed addresses reserved by the hardware. These often have special
1866+
/// semantics associated to their manipulation, and cannot be used as general purpose memory.
1867+
/// Here, any address value is possible, including 0 and [`usize::MAX`], so long as the semantics
1868+
/// of such a write are well-defined by the target hardware. The access must not trap. It can
1869+
/// cause side-effects, but those must not affect Rust-allocated memory in any way. This access is
1870+
/// still not considered [atomic], and as such it cannot be used for inter-thread synchronization.
18731871
///
18741872
/// Note that volatile memory operations on zero-sized types (e.g., if a zero-sized type is passed
18751873
/// to `write_volatile`) are noops and may be ignored.

0 commit comments

Comments
 (0)