track and report cycles using DatabaseKeyIndex

This commit is contained in:
Niko Matsakis 2020-07-01 09:51:40 +00:00
parent 7b5ac6e717
commit 1b778760ae
11 changed files with 118 additions and 157 deletions

View file

@ -431,11 +431,11 @@ pub(crate) fn query_group(args: TokenStream, input: TokenStream) -> TokenStream
let recover = if let Some(cycle_recovery_fn) = &query.cycle {
quote! {
fn recover(db: &DB, cycle: &[DB::DatabaseKey], #key_pattern: &<Self as salsa::Query<DB>>::Key)
fn recover(db: &DB, cycle: &[salsa::DatabaseKeyIndex], #key_pattern: &<Self as salsa::Query<DB>>::Key)
-> Option<<Self as salsa::Query<DB>>::Value> {
Some(#cycle_recovery_fn(
db,
&cycle.iter().map(|k| format!("{:?}", k)).collect::<Vec<String>>(),
&cycle.iter().map(|k| format!("{:?}", k.debug(db))).collect::<Vec<String>>(),
#(#key_names),*
))
}