mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-28 20:16:58 +03:00
move object safety test to library/core
This commit is contained in:
committed by
Mark Rousskov
parent
b842f8c7ff
commit
ca18f75c1b
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
Reference in New Issue
Block a user