t.hash(&mut s);
s.finish()
}
+
+// FIXME: Instantiated functions with i128 in the signature is not supported in Emscripten.
+// See https://github.com/kripken/emscripten-fastcomp/issues/169
+#[cfg(not(target_os = "emscripten"))]
+#[test]
+fn test_boxed_hasher() {
+ let ordinary_hash = hash(&5u32);
+
+ let mut hasher_1 = Box::new(DefaultHasher::new());
+ 5u32.hash(&mut hasher_1);
+ assert_eq!(ordinary_hash, hasher_1.finish());
+
+ let mut hasher_2 = Box::new(DefaultHasher::new()) as Box<Hasher>;
+ 5u32.hash(&mut hasher_2);
+ assert_eq!(ordinary_hash, hasher_2.finish());
+}