diff options
Diffstat (limited to 'compiler/rustc_query_system/src/cache.rs')
-rw-r--r-- | compiler/rustc_query_system/src/cache.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/rustc_query_system/src/cache.rs b/compiler/rustc_query_system/src/cache.rs index 7cc885be2..6e862db0b 100644 --- a/compiler/rustc_query_system/src/cache.rs +++ b/compiler/rustc_query_system/src/cache.rs @@ -7,11 +7,16 @@ use rustc_data_structures::sync::Lock; use std::hash::Hash; -#[derive(Clone)] pub struct Cache<Key, Value> { hashmap: Lock<FxHashMap<Key, WithDepNode<Value>>>, } +impl<Key: Clone, Value: Clone> Clone for Cache<Key, Value> { + fn clone(&self) -> Self { + Self { hashmap: Lock::new(self.hashmap.borrow().clone()) } + } +} + impl<Key, Value> Default for Cache<Key, Value> { fn default() -> Self { Self { hashmap: Default::default() } |