mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 01:04:03 +00:00
29 lines
679 B
Rust
29 lines
679 B
Rust
//@ run-rustfix
|
|
// Issue #109429
|
|
use std::collections::hash_map::DefaultHasher;
|
|
use std::collections::HashMap;
|
|
use std::hash::BuildHasher;
|
|
use std::hash::Hash;
|
|
|
|
#[derive(Clone)]
|
|
pub struct Hash128_1;
|
|
|
|
impl BuildHasher for Hash128_1 {
|
|
type Hasher = DefaultHasher;
|
|
fn build_hasher(&self) -> DefaultHasher { DefaultHasher::default() }
|
|
}
|
|
|
|
#[allow(unused)]
|
|
pub fn hashmap_copy<T, U>(
|
|
map: &HashMap<T, U, Hash128_1>,
|
|
) where T: Hash + Clone, U: Clone
|
|
{
|
|
let mut copy: Vec<U> = <HashMap<T, U, Hash128_1> as Clone>::clone(&map).into_values().collect(); //~ ERROR
|
|
}
|
|
|
|
pub fn make_map() -> HashMap<String, i64, Hash128_1>
|
|
{
|
|
HashMap::with_hasher(Hash128_1)
|
|
}
|
|
fn main() {}
|