@@ -2483,9 +2483,13 @@ impl<T: ?Sized> Eq for *mut T {}
2483
2483
/// by their address rather than comparing the values they point to
2484
2484
/// (which is what the `PartialEq for &T` implementation does).
2485
2485
///
2486
- /// Smart pointer types, such as `Box`, `Rc`, and `Arc` do not compare
2487
- /// using this function, instead they compare the values rather than
2488
- /// their addresses.
2486
+ /// A reference in Rust is sometimes stored different than a raw
2487
+ /// memory address. These cases are called fat pointers. A reference
2488
+ /// to a slice must store both the address of the slice and the length
2489
+ /// of the slice. A reference to an object satisfying a trait must
2490
+ /// also point to the vtable for the trait's methods. Since this
2491
+ /// function compares pointers in totality, careful consideration to
2492
+ /// the type of the variable must be made.
2489
2493
///
2490
2494
/// # Examples
2491
2495
///
@@ -2499,9 +2503,9 @@ impl<T: ?Sized> Eq for *mut T {}
2499
2503
/// let other_five_ref = &other_five;
2500
2504
///
2501
2505
/// assert!(five_ref == same_five_ref);
2502
- /// assert!(five_ref == other_five_ref);
2503
- ///
2504
2506
/// assert!(ptr::eq(five_ref, same_five_ref));
2507
+ ///
2508
+ /// assert!(five_ref == other_five_ref);
2505
2509
/// assert!(!ptr::eq(five_ref, other_five_ref));
2506
2510
/// ```
2507
2511
#[ stable( feature = "ptr_eq" , since = "1.17.0" ) ]
0 commit comments