From 0bbe468271c3afa84c18979d8a5b9574d2bf2070 Mon Sep 17 00:00:00 2001 From: kennytm Date: Mon, 21 Aug 2017 22:15:02 +0800 Subject: impl Hasher for {&mut Hasher, Box} --- src/libcore/tests/hash/mod.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/libcore/tests') 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); +} -- cgit 1.4.1-3-g733a5