Skip to main content

salsa_macro_rules/
unexpected_cycle_recovery.rs

1// Macro that generates the body of the cycle recovery function
2// for the case where no cycle recovery is possible. This has to be
3// a macro because it can take a variadic number of arguments.
4#[macro_export]
5macro_rules! unexpected_cycle_recovery {
6    ($db:ident, $cycle:ident, $last_provisional_value:ident, $new_value:ident, $($other_inputs:ident),*) => {{
7        let (_db, _cycle, _last_provisional_value) = ($db, $cycle, $last_provisional_value);
8        std::mem::drop(($($other_inputs,)*));
9        $new_value
10    }};
11}
12
13#[macro_export]
14macro_rules! unexpected_cycle_initial {
15    ($db:ident, $id:ident, $($other_inputs:ident),*) => {{
16        std::mem::drop($db);
17        std::mem::drop(($($other_inputs,)*));
18        panic!("no cycle initial value")
19    }};
20}