about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2022-05-28 12:39:36 +0200
committerRalf Jung <post@ralfj.de>2022-05-28 12:39:36 +0200
commitad33519455c7f10bc5e7fdb7cc45ef6f1ccc51c4 (patch)
tree87060e97948979b53e7ac426412108f71835bcbc
parentb97bfc3b38ad46fef419950d434d9a8e8f5c2d80 (diff)
downloadrust-ad33519455c7f10bc5e7fdb7cc45ef6f1ccc51c4.tar.gz
rust-ad33519455c7f10bc5e7fdb7cc45ef6f1ccc51c4.zip
ptr::invalid is not equivalent to a int2ptr cast
-rw-r--r--library/core/src/ptr/mod.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/library/core/src/ptr/mod.rs b/library/core/src/ptr/mod.rs
index d2e680ecd20..93728f844dd 100644
--- a/library/core/src/ptr/mod.rs
+++ b/library/core/src/ptr/mod.rs
@@ -557,8 +557,8 @@ pub const fn null_mut<T>() -> *mut T {
 
 /// Creates an invalid pointer with the given address.
 ///
-/// This is *currently* equivalent to `addr as *const T` but it expresses the intended semantic
-/// more clearly, and may become important under future memory models.
+/// This is different from `addr as *const T`, which creates a pointer that picks up a previously
+/// exposed provenance. See [`from_exposed_addr`] for more details on that operation.
 ///
 /// The module's top-level documentation discusses the precise meaning of an "invalid"
 /// pointer but essentially this expresses that the pointer is not associated
@@ -566,7 +566,7 @@ pub const fn null_mut<T>() -> *mut T {
 ///
 /// This pointer will have no provenance associated with it and is therefore
 /// UB to read/write/offset. This mostly exists to facilitate things
-/// like ptr::null and NonNull::dangling which make invalid pointers.
+/// like `ptr::null` and `NonNull::dangling` which make invalid pointers.
 ///
 /// (Standard "Zero-Sized-Types get to cheat and lie" caveats apply, although it
 /// may be desirable to give them their own API just to make that 100% clear.)
@@ -588,8 +588,8 @@ pub const fn invalid<T>(addr: usize) -> *const T {
 
 /// Creates an invalid mutable pointer with the given address.
 ///
-/// This is *currently* equivalent to `addr as *mut T` but it expresses the intended semantic
-/// more clearly, and may become important under future memory models.
+/// This is different from `addr as *mut T`, which creates a pointer that picks up a previously
+/// exposed provenance. See [`from_exposed_addr_mut`] for more details on that operation.
 ///
 /// The module's top-level documentation discusses the precise meaning of an "invalid"
 /// pointer but essentially this expresses that the pointer is not associated
@@ -597,7 +597,7 @@ pub const fn invalid<T>(addr: usize) -> *const T {
 ///
 /// This pointer will have no provenance associated with it and is therefore
 /// UB to read/write/offset. This mostly exists to facilitate things
-/// like ptr::null and NonNull::dangling which make invalid pointers.
+/// like `ptr::null` and `NonNull::dangling` which make invalid pointers.
 ///
 /// (Standard "Zero-Sized-Types get to cheat and lie" caveats apply, although it
 /// may be desirable to give them their own API just to make that 100% clear.)