Skip to content

Commit 9755410

Browse files
committed
Try to fix ptr::hash's doc example
1 parent 4a7ffe2 commit 9755410

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/libcore/ptr.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2516,18 +2516,19 @@ pub fn eq<T: ?Sized>(a: *const T, b: *const T) -> bool {
25162516
///
25172517
/// ```
25182518
/// use std::collections::hash_map::DefaultHasher;
2519-
/// use std::hash::Hasher;
2519+
/// use std::hash::{Hash, Hasher};
25202520
/// use std::ptr;
25212521
///
25222522
/// let five = 5;
25232523
/// let five_ref = &five;
25242524
///
25252525
/// let mut hasher = DefaultHasher::new();
2526+
/// #[feature(ptr_hash)]
25262527
/// ptr::hash(five_ref, &mut hasher);
25272528
/// let actual = hasher.finish();
25282529
///
25292530
/// let mut hasher = DefaultHasher::new();
2530-
/// (five_ref as *const T).hash(&mut hasher);
2531+
/// (five_ref as *const i32).hash(&mut hasher);
25312532
/// let expected = hasher.finish();
25322533
///
25332534
/// assert_eq!(actual, expected);

0 commit comments

Comments
 (0)