mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 08:44:35 +00:00
move object safety test to library/core
This commit is contained in:
parent
481b282e8a
commit
58f988fa40
@ -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());
|
||||
}
|
Loading…
Reference in New Issue
Block a user