diff --git a/sway-core/src/query_engine/mod.rs b/sway-core/src/query_engine/mod.rs index d2397c17bda..b82ae516996 100644 --- a/sway-core/src/query_engine/mod.rs +++ b/sway-core/src/query_engine/mod.rs @@ -47,15 +47,15 @@ pub type ProgramsCacheMap = HashMap; #[derive(Debug, Default)] pub struct QueryEngine { - parse_module_cache: RwLock, - programs_cache: RwLock, + parse_module_cache: Arc>, + programs_cache: Arc>, } impl Clone for QueryEngine { fn clone(&self) -> Self { Self { - parse_module_cache: RwLock::new(self.parse_module_cache.read().unwrap().clone()), - programs_cache: RwLock::new(self.programs_cache.read().unwrap().clone()), + parse_module_cache: self.parse_module_cache.clone(), + programs_cache: self.programs_cache.clone(), } } } @@ -67,11 +67,10 @@ impl QueryEngine { } pub fn insert_parse_module_cache_entry(&self, entry: ModuleCacheEntry) { - let mut cache = self.parse_module_cache.write().unwrap(); let path = entry.path.clone(); let include_tests = entry.include_tests; - let key = ModuleCacheKey::new(path, include_tests); + let mut cache = self.parse_module_cache.write().unwrap(); cache.insert(key, entry); }