Skip to content

Commit

Permalink
explicitly mention that both components of wide prts are compared
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Oct 26, 2022
1 parent 99a74af commit 1946a18
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions library/core/src/ptr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1733,6 +1733,7 @@ pub(crate) unsafe fn align_offset<T: Sized>(p: *const T, a: usize) -> usize {
/// by their address rather than comparing the values they point to
/// (which is what the `PartialEq for &T` implementation does).
///
/// When comparing wide pointers, both the address and the metadata are tested for equality.
/// However, note that comparing trait object pointers (`*const dyn Trait`) is unrealiable: pointers
/// to values of the same underlying type can compare inequal (because vtables are duplicated in
/// multiple codegen units), and pointers to values of *different* underlying type can compare equal
Expand Down

0 comments on commit 1946a18

Please sign in to comment.