We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8125149 commit afb4fbdCopy full SHA for afb4fbd
src/libcore/ptr.rs
@@ -2524,7 +2524,13 @@ pub fn eq<T: ?Sized>(a: *const T, b: *const T) -> bool {
2524
///
2525
/// let mut hasher = DefaultHasher::new();
2526
/// ptr::hash(five_ref, &mut hasher);
2527
-/// println!("Hash is {:x}!", hasher.finish());
+/// let actual = hasher.finish();
2528
+///
2529
+/// let mut hasher = DefaultHasher::new();
2530
+/// (five_ref as *const T).hash(&mut hasher);
2531
+/// let expected = hasher.finish();
2532
2533
+/// assert_eq!(actual, expected);
2534
/// ```
2535
#[unstable(feature = "ptr_hash", reason = "newly added", issue = "56285")]
2536
pub fn hash<T, S: hash::Hasher>(hashee: &T, into: &mut S) {
0 commit comments