@@ -581,12 +581,20 @@ pub const fn invalid_mut<T>(addr: usize) -> *mut T {
581581/// Convert an address back to a pointer, picking up a previously 'exposed' provenance.
582582///
583583/// This is equivalent to `addr as *const T`. The provenance of the returned pointer is that of *any*
584- /// pointer that was previously passed to [`expose_addr`][pointer::expose_addr] or a `ptr as usize`
585- /// cast. If there is no previously 'exposed' provenance that justifies the way this pointer will be
586- /// used, the program has undefined behavior. Note that there is no algorithm that decides which
587- /// provenance will be used. You can think of this as "guessing" the right provenance, and the guess
588- /// will be "maximally in your favor", in the sense that if there is any way to avoid undefined
589- /// behavior, then that is the guess that will be taken.
584+ /// pointer that was previously exposed by passing it to [`expose_addr`][pointer::expose_addr],
585+ /// or a `ptr as usize` cast. In addition, memory which is outside the control of the Rust abstract
586+ /// machine (MMIO registers, for example) is always considered to be exposed, so long as this memory
587+ /// is disjoint from memory that will be used by the abstract machine such as the stack, heap,
588+ /// and statics.
589+ ///
590+ /// If there is no 'exposed' provenance that justifies the way this pointer will be used,
591+ /// the program has undefined behavior. In particular, the aliasing rules still apply: pointers
592+ /// and references that have been invalidated due to aliasing accesses cannot be used any more,
593+ /// even if they have been exposed!
594+ /// Note that there is no algorithm that decides which provenance will be used. You can think of this
595+ /// as "guessing" the right provenance, and the guess will be "maximally in your favor", in the sense
596+ /// that if there is any way to avoid undefined behavior (while upholding all aliasing requirements),
597+ /// then that is the guess that will be taken.
590598///
591599/// On platforms with multiple address spaces, it is your responsibility to ensure that the
592600/// address makes sense in the address space that this pointer will be used with.
0 commit comments