@@ -1763,20 +1763,22 @@ pub const unsafe fn write_unaligned<T>(dst: *mut T, src: T) {
1763
1763
/// - When a volatile operation is used for memory inside an [allocation], it behaves exactly like
1764
1764
/// [`read`], except for the additional guarantee that it won't be elided or reordered (see
1765
1765
/// above). This implies that the operation will actually access memory and not e.g. be lowered to
1766
- /// a register access or stack pop. Other than that, all the usual rules for memory accesses
1767
- /// apply . In particular, just like in C, whether an operation is volatile has no bearing
1768
- /// whatsoever on questions involving concurrent access from multiple threads. Volatile accesses
1769
- /// behave exactly like non-atomic accesses in that regard.
1766
+ /// a register access or stack pop. Other than that, all the usual rules for memory accesses apply
1767
+ /// (including provenance) . In particular, just like in C, whether an operation is volatile has no
1768
+ /// bearing whatsoever on questions involving concurrent access from multiple threads. Volatile
1769
+ /// accesses behave exactly like non-atomic accesses in that regard.
1770
1770
///
1771
1771
/// - Volatile operations, however, may also be used to access memory that is _outside_ of any Rust
1772
1772
/// allocation. In this use-case, the pointer does *not* have to be [valid] for reads. This is
1773
1773
/// typically used for CPU and peripheral registers that must be accessed via an I/O memory
1774
1774
/// mapping, most commonly at fixed addresses reserved by the hardware. These often have special
1775
1775
/// semantics associated to their manipulation, and cannot be used as general purpose memory.
1776
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.
1777
+ /// of such a read are well-defined by the target hardware. The provenance of the pointer is
1778
+ /// irrelevant, and it can be created with [`without_provenance`]. The access must not trap. It
1779
+ /// can cause side-effects, but those must not affect Rust-allocated memory in in any way. This
1780
+ /// access is still not considered [atomic], and as such it cannot be used for inter-thread
1781
+ /// synchronization.
1780
1782
///
1781
1783
/// Note that volatile memory operations on zero-sized types (e.g., if a zero-sized type is passed
1782
1784
/// to `read_volatile`) are noops and may be ignored.
@@ -1854,20 +1856,22 @@ pub unsafe fn read_volatile<T>(src: *const T) -> T {
1854
1856
/// - When a volatile operation is used for memory inside an [allocation], it behaves exactly like
1855
1857
/// [`write()`], except for the additional guarantee that it won't be elided or reordered (see
1856
1858
/// above). This implies that the operation will actually access memory and not e.g. be lowered to
1857
- /// a register access or stack pop. Other than that, all the usual rules for memory accesses
1858
- /// apply . In particular, just like in C, whether an operation is volatile has no bearing
1859
- /// whatsoever on questions involving concurrent access from multiple threads. Volatile accesses
1860
- /// behave exactly like non-atomic accesses in that regard.
1859
+ /// a register access or stack pop. Other than that, all the usual rules for memory accesses apply
1860
+ /// (including provenance) . In particular, just like in C, whether an operation is volatile has no
1861
+ /// bearing whatsoever on questions involving concurrent access from multiple threads. Volatile
1862
+ /// accesses behave exactly like non-atomic accesses in that regard.
1861
1863
///
1862
1864
/// - Volatile operations, however, may also be used to access memory that is _outside_ of any Rust
1863
1865
/// allocation. In this use-case, the pointer does *not* have to be [valid] for writes. This is
1864
1866
/// typically used for CPU and peripheral registers that must be accessed via an I/O memory
1865
1867
/// mapping, most commonly at fixed addresses reserved by the hardware. These often have special
1866
1868
/// semantics associated to their manipulation, and cannot be used as general purpose memory.
1867
1869
/// 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.
1870
+ /// of such a write are well-defined by the target hardware. The provenance of the pointer is
1871
+ /// irrelevant, and it can be created with [`without_provenance`]. The access must not trap. It
1872
+ /// can cause side-effects, but those must not affect Rust-allocated memory in any way. This
1873
+ /// access is still not considered [atomic], and as such it cannot be used for inter-thread
1874
+ /// synchronization.
1871
1875
///
1872
1876
/// Note that volatile memory operations on zero-sized types (e.g., if a zero-sized type is passed
1873
1877
/// to `write_volatile`) are noops and may be ignored.
0 commit comments