Skip to content

Commit 9ba6153

Browse files
hkBstgitbot
authored and
gitbot
committed
document ptr comparison being by address
1 parent 60d6184 commit 9ba6153

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

core/src/ptr/const_ptr.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1681,7 +1681,7 @@ impl<T, const N: usize> *const [T; N] {
16811681
}
16821682
}
16831683

1684-
// Equality for pointers
1684+
/// Pointer equality is by address, as produced by the [`<*const T>::addr`](pointer::addr) method.
16851685
#[stable(feature = "rust1", since = "1.0.0")]
16861686
impl<T: ?Sized> PartialEq for *const T {
16871687
#[inline]
@@ -1691,10 +1691,11 @@ impl<T: ?Sized> PartialEq for *const T {
16911691
}
16921692
}
16931693

1694+
/// Pointer equality is an equivalence relation.
16941695
#[stable(feature = "rust1", since = "1.0.0")]
16951696
impl<T: ?Sized> Eq for *const T {}
16961697

1697-
// Comparison for pointers
1698+
/// Pointer comparison is by address, as produced by the `[`<*const T>::addr`](pointer::addr)` method.
16981699
#[stable(feature = "rust1", since = "1.0.0")]
16991700
impl<T: ?Sized> Ord for *const T {
17001701
#[inline]
@@ -1710,6 +1711,7 @@ impl<T: ?Sized> Ord for *const T {
17101711
}
17111712
}
17121713

1714+
/// Pointer comparison is by address, as produced by the `[`<*const T>::addr`](pointer::addr)` method.
17131715
#[stable(feature = "rust1", since = "1.0.0")]
17141716
impl<T: ?Sized> PartialOrd for *const T {
17151717
#[inline]

core/src/ptr/mut_ptr.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -2097,7 +2097,7 @@ impl<T, const N: usize> *mut [T; N] {
20972097
}
20982098
}
20992099

2100-
// Equality for pointers
2100+
/// Pointer equality is by address, as produced by the [`<*mut T>::addr`](pointer::addr) method.
21012101
#[stable(feature = "rust1", since = "1.0.0")]
21022102
impl<T: ?Sized> PartialEq for *mut T {
21032103
#[inline(always)]
@@ -2107,9 +2107,11 @@ impl<T: ?Sized> PartialEq for *mut T {
21072107
}
21082108
}
21092109

2110+
/// Pointer equality is an equivalence relation.
21102111
#[stable(feature = "rust1", since = "1.0.0")]
21112112
impl<T: ?Sized> Eq for *mut T {}
21122113

2114+
/// Pointer comparison is by address, as produced by the [`<*mut T>::addr`](pointer::addr) method.
21132115
#[stable(feature = "rust1", since = "1.0.0")]
21142116
impl<T: ?Sized> Ord for *mut T {
21152117
#[inline]
@@ -2125,6 +2127,7 @@ impl<T: ?Sized> Ord for *mut T {
21252127
}
21262128
}
21272129

2130+
/// Pointer comparison is by address, as produced by the [`<*mut T>::addr`](pointer::addr) method.
21282131
#[stable(feature = "rust1", since = "1.0.0")]
21292132
impl<T: ?Sized> PartialOrd for *mut T {
21302133
#[inline(always)]

0 commit comments

Comments
 (0)