@@ -67,8 +67,10 @@ impl<T: ?Sized> *mut T {
67
67
/// and cannot be created from one without additional context.
68
68
///
69
69
/// If you would like to treat a pointer like an integer anyway,
70
- /// see [`addr`][#method.addr-1] and [`with_addr`][#method.with_addr-1] for
71
- /// the responsible way to do that.
70
+ /// see [`addr`] and [`with_addr`] for the responsible way to do that.
71
+ ///
72
+ /// [`addr`]: pointer::addr
73
+ /// [`with_addr`]: pointer::with_addr
72
74
#[ unstable( feature = "ptr_to_from_bits" , issue = "91126" ) ]
73
75
pub fn to_bits ( self ) -> [ u8 ; core:: mem:: size_of :: < * mut ( ) > ( ) ]
74
76
where
@@ -110,8 +112,10 @@ impl<T: ?Sized> *mut T {
110
112
/// and is equivalent to the deprecated `ptr as usize` cast.
111
113
///
112
114
/// On more complicated platforms like CHERI and segmented architectures,
113
- /// this may remove some important metadata. See [`with_addr`][#method.with_addr-1] for
115
+ /// this may remove some important metadata. See [`with_addr`] for
114
116
/// details on this distinction and why it's important.
117
+ ///
118
+ /// [`with_addr`]: pointer::with_addr
115
119
#[ unstable( feature = "strict_provenance" , issue = "99999999" ) ]
116
120
pub fn addr ( self ) -> usize
117
121
where
@@ -154,6 +158,7 @@ impl<T: ?Sized> *mut T {
154
158
/// with tagged pointers. Here we have a tag in the lowest bit:
155
159
///
156
160
/// ```text
161
+ /// #![feature(strict_provenance)]
157
162
/// let my_tagged_ptr: *mut T = ...;
158
163
///
159
164
/// // Get the address and do whatever bit tricks we like
@@ -352,7 +357,7 @@ impl<T: ?Sized> *mut T {
352
357
/// enables more aggressive compiler optimizations.
353
358
///
354
359
/// [`wrapping_offset`]: #method.wrapping_offset
355
- /// [allocated object]: crate::ptr#allocated-object
360
+ /// [allocated object]: crate::ptr#allocated-objects-and-provenance
356
361
///
357
362
/// # Examples
358
363
///
@@ -440,7 +445,7 @@ impl<T: ?Sized> *mut T {
440
445
/// platform-specific and not at all portable.
441
446
///
442
447
/// [`offset`]: #method.offset
443
- /// [allocated object]: crate::ptr#allocated-object
448
+ /// [allocated object]: crate::ptr#allocated-objects-and-provenance
444
449
///
445
450
/// # Examples
446
451
///
@@ -683,7 +688,7 @@ impl<T: ?Sized> *mut T {
683
688
/// such large allocations either.)
684
689
///
685
690
/// [`add`]: #method.add
686
- /// [allocated object]: crate::ptr#allocated-object
691
+ /// [allocated object]: crate::ptr#allocated-objects-and-provenance
687
692
///
688
693
/// # Panics
689
694
///
@@ -708,6 +713,7 @@ impl<T: ?Sized> *mut T {
708
713
/// *Incorrect* usage:
709
714
///
710
715
/// ```rust,no_run
716
+ /// #![feature(strict_provenance)]
711
717
/// let ptr1 = Box::into_raw(Box::new(0u8));
712
718
/// let ptr2 = Box::into_raw(Box::new(1u8));
713
719
/// let diff = (ptr2.addr() as isize).wrapping_sub(ptr1.addr() as isize);
@@ -768,7 +774,7 @@ impl<T: ?Sized> *mut T {
768
774
/// enables more aggressive compiler optimizations.
769
775
///
770
776
/// [`wrapping_add`]: #method.wrapping_add
771
- /// [allocated object]: crate::ptr#allocated-object
777
+ /// [allocated object]: crate::ptr#allocated-objects-and-provenance
772
778
///
773
779
/// # Examples
774
780
///
@@ -832,7 +838,7 @@ impl<T: ?Sized> *mut T {
832
838
/// enables more aggressive compiler optimizations.
833
839
///
834
840
/// [`wrapping_sub`]: #method.wrapping_sub
835
- /// [allocated object]: crate::ptr#allocated-object
841
+ /// [allocated object]: crate::ptr#allocated-objects-and-provenance
836
842
///
837
843
/// # Examples
838
844
///
@@ -889,7 +895,7 @@ impl<T: ?Sized> *mut T {
889
895
/// allocated object and then re-entering it later is permitted.
890
896
///
891
897
/// [`add`]: #method.add
892
- /// [allocated object]: crate::ptr#allocated-object
898
+ /// [allocated object]: crate::ptr#allocated-objects-and-provenance
893
899
///
894
900
/// # Examples
895
901
///
@@ -951,7 +957,7 @@ impl<T: ?Sized> *mut T {
951
957
/// allocated object and then re-entering it later is permitted.
952
958
///
953
959
/// [`sub`]: #method.sub
954
- /// [allocated object]: crate::ptr#allocated-object
960
+ /// [allocated object]: crate::ptr#allocated-objects-and-provenance
955
961
///
956
962
/// # Examples
957
963
///
@@ -1456,7 +1462,7 @@ impl<T> *mut [T] {
1456
1462
/// See also [`slice::from_raw_parts`][].
1457
1463
///
1458
1464
/// [valid]: crate::ptr#safety
1459
- /// [allocated object]: crate::ptr#allocated-object
1465
+ /// [allocated object]: crate::ptr#allocated-objects-and-provenance
1460
1466
#[ inline]
1461
1467
#[ unstable( feature = "ptr_as_uninit" , issue = "75402" ) ]
1462
1468
#[ rustc_const_unstable( feature = "const_ptr_as_ref" , issue = "91822" ) ]
@@ -1508,7 +1514,7 @@ impl<T> *mut [T] {
1508
1514
/// See also [`slice::from_raw_parts_mut`][].
1509
1515
///
1510
1516
/// [valid]: crate::ptr#safety
1511
- /// [allocated object]: crate::ptr#allocated-object
1517
+ /// [allocated object]: crate::ptr#allocated-objects-and-provenance
1512
1518
#[ inline]
1513
1519
#[ unstable( feature = "ptr_as_uninit" , issue = "75402" ) ]
1514
1520
#[ rustc_const_unstable( feature = "const_ptr_as_ref" , issue = "91822" ) ]
0 commit comments