Skip to content

Commit

Permalink
Minor rewordings and add dyn keyword
Browse files Browse the repository at this point in the history
  • Loading branch information
czipperz committed Mar 27, 2019
1 parent fbfc808 commit 61b6c56
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/libcore/ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2523,26 +2523,26 @@ impl<T: ?Sized> Eq for *mut T {}
/// fn main() {
/// let wrapper = Wrapper { member: 10 };
///
/// // Pointers are equal address
/// // Pointers have equal addresses.
/// assert!(std::ptr::eq(
/// &wrapper as *const Wrapper as *const u8,
/// &wrapper.member as *const i32 as *const u8
/// ));
///
/// // Objects have equal addresses, but `Trait` has different implementations
/// // Objects have equal addresses, but `Trait` has different implementations.
/// assert!(!std::ptr::eq(
/// &wrapper as &Trait,
/// &wrapper.member as &Trait,
/// &wrapper as &dyn Trait,
/// &wrapper.member as &dyn Trait,
/// ));
/// assert!(!std::ptr::eq(
/// &wrapper as &Trait as *const Trait,
/// &wrapper.member as &Trait as *const Trait,
/// &wrapper as &dyn Trait as *const dyn Trait,
/// &wrapper.member as &dyn Trait as *const dyn Trait,
/// ));
///
/// // Converting the reference to a `*const u8` compares by address
/// // Converting the reference to a `*const u8` compares by address.
/// assert!(std::ptr::eq(
/// &wrapper as &Trait as *const Trait as *const u8,
/// &wrapper.member as &Trait as *const Trait as *const u8,
/// &wrapper as &dyn Trait as *const dyn Trait as *const u8,
/// &wrapper.member as &dyn Trait as *const dyn Trait as *const u8,
/// ));
/// }
/// ```
Expand Down

0 comments on commit 61b6c56

Please sign in to comment.