diff --git a/library/core/tests/hash/mod.rs b/library/core/tests/hash/mod.rs index 1566d35749017..72ccdd4848a47 100644 --- a/library/core/tests/hash/mod.rs +++ b/library/core/tests/hash/mod.rs @@ -1,7 +1,7 @@ mod sip; use std::default::Default; -use std::hash::{Hash, Hasher}; +use std::hash::{BuildHasher, Hash, Hasher}; use std::rc::Rc; struct MyHasher { @@ -139,3 +139,10 @@ fn test_indirect_hasher() { } assert_eq!(hasher.hash, 5); } + +#[test] +fn test_build_hasher_object_safe() { + use std::collections::hash_map::{DefaultHasher, RandomState}; + + let _: &dyn BuildHasher = &RandomState::new(); +} diff --git a/src/test/ui/build-hasher-object-safe.rs b/src/test/ui/build-hasher-object-safe.rs deleted file mode 100644 index 50ec8e5e8d96e..0000000000000 --- a/src/test/ui/build-hasher-object-safe.rs +++ /dev/null @@ -1,10 +0,0 @@ -// run-pass - -use std::hash::BuildHasher; -use std::collections::hash_map::{DefaultHasher, RandomState}; - -fn ensure_object_safe(_: &dyn BuildHasher) {} - -fn main() { - ensure_object_safe(&RandomState::new()); -}