diff --git a/crates/libanalysis/src/db.rs b/crates/libanalysis/src/db.rs index d67cc189cd..d30e75fe2b 100644 --- a/crates/libanalysis/src/db.rs +++ b/crates/libanalysis/src/db.rs @@ -91,12 +91,13 @@ impl Clone for Db { } } +type QueryDeps = Vec<(QueryInvocationId, Arc, OutputHash)>; #[derive(Default, Debug)] pub(crate) struct Cache { gen: Gen, green: im::HashMap, - deps: im::HashMap>, + deps: im::HashMap, results: im::HashMap>, } @@ -124,7 +125,7 @@ impl Cache { pub(crate) struct QueryCtx { db: Arc, - stack: RefCell)>>, + stack: RefCell>, pub(crate) trace: RefCell>, } @@ -148,7 +149,8 @@ impl QueryCtx { { let mut stack = self.stack.borrow_mut(); if let Some((_, ref mut deps)) = stack.last_mut() { - deps.push((me, output_hash::(&res))); + let params = Arc::new(params.clone()); + deps.push((me, params, output_hash::(&res))); } } @@ -161,7 +163,7 @@ impl QueryCtx { pub(crate) trait Query { const ID: u32; - type Params: Hash + Eq + Debug + Any + 'static; + type Params: Hash + Eq + Debug + Clone + Any + 'static; type Output: Hash + Debug + Any + 'static; } @@ -212,7 +214,7 @@ where }; let deps_are_fresh = cache.deps[&id] .iter() - .all(|&(dep_id, dep_hash)| { + .all(|&(dep_id, _, dep_hash)| { match cache.green.get(&dep_id) { //TODO: store the value of parameters, and re-execute the query Some((gen, hash)) if gen == &curr_gen && hash == &dep_hash => true,