1 use std::collections::{HashMap, HashSet};
2 use std::hash::{Hash, Hasher};
3 use std::sync::atomic::{AtomicUsize, Ordering::Relaxed};
5 struct Key(AtomicUsize);
8 fn clone(&self) -> Self {
9 Key(AtomicUsize::new(self.0.load(Relaxed)))
13 impl PartialEq for Key {
14 fn eq(&self, other: &Self) -> bool {
15 self.0.load(Relaxed) == other.0.load(Relaxed)
22 fn hash<H: Hasher>(&self, h: &mut H) {
23 self.0.load(Relaxed).hash(h);
27 fn should_not_take_this_arg(m: &mut HashMap<Key, usize>, _n: usize) -> HashSet<Key> {
28 let _other: HashMap<Key, bool> = HashMap::new();
29 m.keys().cloned().collect()
32 fn this_is_ok(m: &mut HashMap<usize, Key>) {}
35 let _ = should_not_take_this_arg(&mut HashMap::new(), 1);
36 this_is_ok(&mut HashMap::new());