move object safety test to library/core

This commit is contained in:
ibraheemdev 2021-08-15 13:00:25 -04:00
parent 481b282e8a
commit 58f988fa40
2 changed files with 8 additions and 11 deletions

View File

@ -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<Hasher = DefaultHasher> = &RandomState::new();
}

View File

@ -1,10 +0,0 @@
// run-pass
use std::hash::BuildHasher;
use std::collections::hash_map::{DefaultHasher, RandomState};
fn ensure_object_safe(_: &dyn BuildHasher<Hasher = DefaultHasher>) {}
fn main() {
ensure_object_safe(&RandomState::new());
}