Skip to content

Commit 1946a18

Browse files
committed
explicitly mention that both components of wide prts are compared
1 parent 99a74af commit 1946a18

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

library/core/src/ptr/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1733,6 +1733,7 @@ pub(crate) unsafe fn align_offset<T: Sized>(p: *const T, a: usize) -> usize {
17331733
/// by their address rather than comparing the values they point to
17341734
/// (which is what the `PartialEq for &T` implementation does).
17351735
///
1736+
/// When comparing wide pointers, both the address and the metadata are tested for equality.
17361737
/// However, note that comparing trait object pointers (`*const dyn Trait`) is unrealiable: pointers
17371738
/// to values of the same underlying type can compare inequal (because vtables are duplicated in
17381739
/// multiple codegen units), and pointers to values of *different* underlying type can compare equal

0 commit comments

Comments
 (0)