about summary refs log tree commit diff
path: root/src/libcore/tests
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2017-08-21 22:15:02 +0800
committerkennytm <kennytm@gmail.com>2017-09-12 17:28:07 +0800
commit0bbe468271c3afa84c18979d8a5b9574d2bf2070 (patch)
treeb20040d59dbb344651f9553860e4be194369abdd /src/libcore/tests
parent3cb24bd37bcc46ecbb1f5f3f96f9d1de0aa7e92d (diff)
impl Hasher for {&mut Hasher, Box<Hasher>}
Diffstat (limited to 'src/libcore/tests')
-rw-r--r--src/libcore/tests/hash/mod.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libcore/tests/hash/mod.rs b/src/libcore/tests/hash/mod.rs
index 53ac17c052f..49e41f02428 100644
--- a/src/libcore/tests/hash/mod.rs
+++ b/src/libcore/tests/hash/mod.rs
@@ -109,3 +109,13 @@ fn test_custom_state() {
 
     assert_eq!(hash(&Custom { hash: 5 }), 5);
 }
+
+#[test]
+fn test_indirect_hasher() {
+    let mut hasher = MyHasher { hash: 0 };
+    {
+        let mut indirect_hasher: &mut Hasher = &mut hasher;
+        5u32.hash(&mut indirect_hasher);
+    }
+    assert_eq!(hasher.hash, 5);
+}