Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions library/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
#![feature(adt_const_params)]
#![feature(allow_internal_unsafe)]
#![feature(allow_internal_unstable)]
#![feature(arbitrary_self_types_pointers)]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth explicitly adding this to the tracking issue, or do we think it's fine to stabilize the methods added here without worrying about this feature?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add a note to the tracking issue.

#![feature(auto_traits)]
#![feature(cfg_sanitize)]
#![feature(cfg_target_has_atomic)]
Expand Down
26 changes: 14 additions & 12 deletions library/core/src/ptr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2067,12 +2067,13 @@ pub const unsafe fn write_unaligned<T>(dst: *mut T, src: T) {
/// are two cases of usage that need to be distinguished:
///
/// - When a volatile operation is used for memory inside an [allocation], it behaves exactly like
/// [`read`], except for the additional guarantee that it won't be elided or reordered (see
/// above). This implies that the operation will actually access memory and not e.g. be lowered to
/// reusing data from a previous read. Other than that, all the usual rules for memory accesses
/// apply (including provenance). In particular, just like in C, whether an operation is volatile
/// has no bearing whatsoever on questions involving concurrent accesses from multiple threads.
/// Volatile accesses behave exactly like non-atomic accesses in that regard.
/// [`read`], except for the additional guarantee that it won't be elided or reordered across
/// other externally observable events (see above). This implies that the operation will actually
/// access memory and not e.g. be lowered to reusing data from a previous read. Other than that,
/// all the usual rules for memory accesses apply (including provenance). In particular, just
/// like in C, whether an operation is volatile has no bearing whatsoever on questions involving
/// concurrent accesses from multiple threads. Volatile accesses behave exactly like non-atomic
/// accesses in that regard.
///
/// - Volatile operations, however, may also be used to access memory that is _outside_ of any Rust
/// allocation. In this use-case, the pointer does *not* have to be [valid] for reads. This is
Expand Down Expand Up @@ -2174,11 +2175,12 @@ pub const unsafe fn read_volatile<T>(src: *const T) -> T {
///
/// - When a volatile operation is used for memory inside an [allocation], it behaves exactly like
/// [`write`][write()], except for the additional guarantee that it won't be elided or reordered
/// (see above). This implies that the operation will actually access memory and not e.g. be
/// lowered to a register access. Other than that, all the usual rules for memory accesses apply
/// (including provenance). In particular, just like in C, whether an operation is volatile has no
/// bearing whatsoever on questions involving concurrent access from multiple threads. Volatile
/// accesses behave exactly like non-atomic accesses in that regard.
/// across other externally observable events (see above). This implies that the operation will
/// actually access memory and not e.g. be lowered to a register access. Other than that, all the
/// usual rules for memory accesses apply (including provenance). In particular, just like in C,
/// whether an operation is volatile has no bearing whatsoever on questions involving concurrent
/// access from multiple threads. Volatile accesses behave exactly like non-atomic accesses in
/// that regard.
///
/// - Volatile operations, however, may also be used to access memory that is _outside_ of any Rust
/// allocation. In this use-case, the pointer does *not* have to be [valid] for writes. This is
Expand All @@ -2187,7 +2189,7 @@ pub const unsafe fn read_volatile<T>(src: *const T) -> T {
/// semantics associated to their manipulation, and cannot be used as general purpose memory.
/// Here, any address value is possible, including 0 and [`usize::MAX`], so long as the semantics
/// of such a write are well-defined by the target hardware. The provenance of the pointer is
/// irrelevant, and it can be created with [`without_provenance`]. The access must not trap. It
/// irrelevant, and it can be created with [`without_provenance_mut`]. The access must not trap. It
/// can cause side-effects, but those must not affect Rust-allocated memory in any way. This
/// access is still not considered [atomic], and as such it cannot be used for inter-thread
/// synchronization.
Expand Down
Loading
Loading