Skip to content

Commit 8643aa4

Browse files
committed
fixup ptr docs
1 parent e60b84b commit 8643aa4

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

library/core/src/ptr/const_ptr.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ impl<T: ?Sized> *const T {
6767
/// and cannot be created from one without additional context.
6868
///
6969
/// If you would like to treat a pointer like an integer anyway,
70-
/// see [`addr`][] and [`with_addr`][] for the responsible way to do that.
70+
/// see [`addr`][#method.addr-1] and [`with_addr`][#method.with_addr-1] for the responsible
71+
/// way to do that.
7172
#[unstable(feature = "ptr_to_from_bits", issue = "91126")]
7273
pub fn to_bits(self) -> [u8; core::mem::size_of::<*const ()>()]
7374
where
@@ -109,7 +110,7 @@ impl<T: ?Sized> *const T {
109110
/// and is equivalent to the deprecated `ptr as usize` cast.
110111
///
111112
/// On more complicated platforms like CHERI and segmented architectures,
112-
/// this may remove some important metadata. See [`with_addr`][] for
113+
/// this may remove some important metadata. See [`with_addr`][#method.with_addr-1] for
113114
/// details on this distinction and why it's important.
114115
#[unstable(feature = "strict_provenance", issue = "99999999")]
115116
pub fn addr(self) -> usize
@@ -122,8 +123,6 @@ impl<T: ?Sized> *const T {
122123

123124
/// Creates a new pointer with the given address.
124125
///
125-
/// See also: [`ptr::fake_alloc`][] and [`ptr::zst_exists`][].
126-
///
127126
/// This replaces the deprecated `usize as ptr` cast, which had
128127
/// fundamentally broken semantics because it couldn't restore
129128
/// *segment* and *provenance*.

library/core/src/ptr/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
//! [zst]: ../../nomicon/exotic-sizes.html#zero-sized-types-zsts
9494
//! [atomic operations]: crate::sync::atomic
9595
//! [`offset`]: pointer::offset
96-
//! [`zst_exists`]: pointer::zst_exists
96+
//! [`zst_exists`]: core::ptr::zst_exists
9797
9898
#![stable(feature = "rust1", since = "1.0.0")]
9999

@@ -337,7 +337,7 @@ where
337337
/// This is a problem for Pointer Provenance and Segmenting, because there
338338
/// is no "chain of custody" to an allocation. One possible solution to this
339339
/// is for the programmer to Pretend To Be Malloc and "allocate" the address.
340-
/// See [`with_addr`] for more details.
340+
/// See [`pointer::with_addr`] for more details.
341341
///
342342
/// Just as with *real* malloc, the compiler is free to assume the pointer
343343
/// returned from this function is completely unaliased, and that all accesses

library/core/src/ptr/mut_ptr.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ impl<T: ?Sized> *mut T {
7070
/// and cannot be created from one without additional context.
7171
///
7272
/// If you would like to treat a pointer like an integer anyway,
73-
/// see [`addr`][] and [`with_addr`][] for the responsible way to do that.
73+
/// see [`addr`][#method.addr-1] and [`with_addr`][#method.with_addr-1] for
74+
/// the responsible way to do that.
7475
#[unstable(feature = "ptr_to_from_bits", issue = "91126")]
7576
pub fn to_bits(self) -> [u8; core::mem::size_of::<*mut ()>()]
7677
where
@@ -112,7 +113,7 @@ impl<T: ?Sized> *mut T {
112113
/// and is equivalent to the deprecated `ptr as usize` cast.
113114
///
114115
/// On more complicated platforms like CHERI and segmented architectures,
115-
/// this may remove some important metadata. See [`with_addr`][] for
116+
/// this may remove some important metadata. See [`with_addr`][#method.with_addr-1] for
116117
/// details on this distinction and why it's important.
117118
#[unstable(feature = "strict_provenance", issue = "99999999")]
118119
pub fn addr(self) -> usize
@@ -125,8 +126,6 @@ impl<T: ?Sized> *mut T {
125126

126127
/// Creates a new pointer with the given address.
127128
///
128-
/// See also: [`ptr::fake_alloc`][] and [`ptr::zst_exists`][].
129-
///
130129
/// This replaces the deprecated `usize as ptr` cast, which had
131130
/// fundamentally broken semantics because it couldn't restore
132131
/// *segment* and *provenance*.

0 commit comments

Comments
 (0)