mirror of
https://github.com/salsa-rs/salsa.git
synced 2025-01-15 01:39:25 +00:00
generate a custom std::fmt::Debug
impl
This leads less representation information and in particular avoids serializing pointers.
This commit is contained in:
parent
d98485d3cb
commit
4f4d01958f
15 changed files with 195 additions and 227 deletions
|
@ -58,6 +58,7 @@ impl InputStruct {
|
||||||
let from_id_impl = self.from_id_impl();
|
let from_id_impl = self.from_id_impl();
|
||||||
let salsa_struct_in_db_impl = self.salsa_struct_in_db_impl();
|
let salsa_struct_in_db_impl = self.salsa_struct_in_db_impl();
|
||||||
let as_debug_with_db_impl = self.as_debug_with_db_impl();
|
let as_debug_with_db_impl = self.as_debug_with_db_impl();
|
||||||
|
let debug_impl = self.debug_impl();
|
||||||
|
|
||||||
Ok(quote! {
|
Ok(quote! {
|
||||||
#id_struct
|
#id_struct
|
||||||
|
@ -67,6 +68,7 @@ impl InputStruct {
|
||||||
#from_id_impl
|
#from_id_impl
|
||||||
#as_debug_with_db_impl
|
#as_debug_with_db_impl
|
||||||
#salsa_struct_in_db_impl
|
#salsa_struct_in_db_impl
|
||||||
|
#debug_impl
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,6 +68,7 @@ impl InternedStruct {
|
||||||
let named_fields_impl = self.inherent_impl_for_named_fields();
|
let named_fields_impl = self.inherent_impl_for_named_fields();
|
||||||
let salsa_struct_in_db_impl = self.salsa_struct_in_db_impl();
|
let salsa_struct_in_db_impl = self.salsa_struct_in_db_impl();
|
||||||
let as_debug_with_db_impl = self.as_debug_with_db_impl();
|
let as_debug_with_db_impl = self.as_debug_with_db_impl();
|
||||||
|
let debug_impl = self.debug_impl();
|
||||||
let update_impl = self.update_impl();
|
let update_impl = self.update_impl();
|
||||||
|
|
||||||
Ok(crate::debug::dump_tokens(
|
Ok(crate::debug::dump_tokens(
|
||||||
|
@ -86,6 +87,7 @@ impl InternedStruct {
|
||||||
#salsa_struct_in_db_impl
|
#salsa_struct_in_db_impl
|
||||||
#as_debug_with_db_impl
|
#as_debug_with_db_impl
|
||||||
#update_impl
|
#update_impl
|
||||||
|
#debug_impl
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
|
@ -309,7 +309,7 @@ impl<A: AllowedOptions> SalsaStruct<A> {
|
||||||
|
|
||||||
parse_quote_spanned! { ident.span() =>
|
parse_quote_spanned! { ident.span() =>
|
||||||
#(#attrs)*
|
#(#attrs)*
|
||||||
#[derive(Copy, Clone, PartialEq, PartialOrd, Eq, Ord, Hash, Debug)]
|
#[derive(Copy, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
|
||||||
#visibility struct #ident(salsa::Id);
|
#visibility struct #ident(salsa::Id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -347,7 +347,7 @@ impl<A: AllowedOptions> SalsaStruct<A> {
|
||||||
|
|
||||||
Ok(parse_quote_spanned! { ident.span() =>
|
Ok(parse_quote_spanned! { ident.span() =>
|
||||||
#(#attrs)*
|
#(#attrs)*
|
||||||
#[derive(Copy, Clone, PartialEq, PartialOrd, Eq, Ord, Hash, Debug)]
|
#[derive(Copy, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
|
||||||
#visibility struct #ident #generics (
|
#visibility struct #ident #generics (
|
||||||
*const salsa::#module::ValueStruct < #config_ident >,
|
*const salsa::#module::ValueStruct < #config_ident >,
|
||||||
std::marker::PhantomData < & #lifetime salsa::#module::ValueStruct < #config_ident > >
|
std::marker::PhantomData < & #lifetime salsa::#module::ValueStruct < #config_ident > >
|
||||||
|
@ -465,6 +465,27 @@ impl<A: AllowedOptions> SalsaStruct<A> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Generate `impl salsa::DebugWithDb for Foo`, but only if this is an id struct.
|
||||||
|
pub(crate) fn debug_impl(&self) -> syn::ItemImpl {
|
||||||
|
let ident = self.the_ident();
|
||||||
|
let (impl_generics, type_generics, where_clause) =
|
||||||
|
self.struct_item.generics.split_for_impl();
|
||||||
|
let ident_string = ident.to_string();
|
||||||
|
|
||||||
|
// `use ::salsa::debug::helper::Fallback` is needed for the fallback to `Debug` impl
|
||||||
|
parse_quote_spanned! {ident.span()=>
|
||||||
|
impl #impl_generics ::std::fmt::Debug for #ident #type_generics
|
||||||
|
#where_clause
|
||||||
|
{
|
||||||
|
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
|
||||||
|
f.debug_struct(#ident_string)
|
||||||
|
.field("[salsa id]", &self.salsa_id().as_u32())
|
||||||
|
.finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Generate `impl salsa::DebugWithDb for Foo`, but only if this is an id struct.
|
/// Generate `impl salsa::DebugWithDb for Foo`, but only if this is an id struct.
|
||||||
pub(crate) fn as_debug_with_db_impl(&self) -> Option<syn::ItemImpl> {
|
pub(crate) fn as_debug_with_db_impl(&self) -> Option<syn::ItemImpl> {
|
||||||
if self.customizations.contains(&Customization::DebugWithDb) {
|
if self.customizations.contains(&Customization::DebugWithDb) {
|
||||||
|
|
|
@ -67,6 +67,7 @@ impl TrackedStruct {
|
||||||
let send_sync_impls = self.send_sync_impls();
|
let send_sync_impls = self.send_sync_impls();
|
||||||
let from_id_impl = self.from_id_impl();
|
let from_id_impl = self.from_id_impl();
|
||||||
let lookup_id_impl = self.lookup_id_impl();
|
let lookup_id_impl = self.lookup_id_impl();
|
||||||
|
let debug_impl = self.debug_impl();
|
||||||
let as_debug_with_db_impl = self.as_debug_with_db_impl();
|
let as_debug_with_db_impl = self.as_debug_with_db_impl();
|
||||||
Ok(quote! {
|
Ok(quote! {
|
||||||
#config_struct
|
#config_struct
|
||||||
|
@ -82,6 +83,7 @@ impl TrackedStruct {
|
||||||
#(#send_sync_impls)*
|
#(#send_sync_impls)*
|
||||||
#lookup_id_impl
|
#lookup_id_impl
|
||||||
#as_debug_with_db_impl
|
#as_debug_with_db_impl
|
||||||
|
#debug_impl
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -381,25 +381,19 @@ fn parse_print() {
|
||||||
[salsa id]: 0,
|
[salsa id]: 0,
|
||||||
statements: [
|
statements: [
|
||||||
Statement {
|
Statement {
|
||||||
span: Span(
|
span: Span {
|
||||||
Id {
|
[salsa id]: 4,
|
||||||
value: 5,
|
},
|
||||||
},
|
|
||||||
),
|
|
||||||
data: Print(
|
data: Print(
|
||||||
Expression {
|
Expression {
|
||||||
span: Span(
|
span: Span {
|
||||||
Id {
|
[salsa id]: 3,
|
||||||
value: 4,
|
},
|
||||||
},
|
|
||||||
),
|
|
||||||
data: Op(
|
data: Op(
|
||||||
Expression {
|
Expression {
|
||||||
span: Span(
|
span: Span {
|
||||||
Id {
|
[salsa id]: 0,
|
||||||
value: 1,
|
},
|
||||||
},
|
|
||||||
),
|
|
||||||
data: Number(
|
data: Number(
|
||||||
OrderedFloat(
|
OrderedFloat(
|
||||||
1.0,
|
1.0,
|
||||||
|
@ -408,11 +402,9 @@ fn parse_print() {
|
||||||
},
|
},
|
||||||
Add,
|
Add,
|
||||||
Expression {
|
Expression {
|
||||||
span: Span(
|
span: Span {
|
||||||
Id {
|
[salsa id]: 2,
|
||||||
value: 3,
|
},
|
||||||
},
|
|
||||||
),
|
|
||||||
data: Number(
|
data: Number(
|
||||||
OrderedFloat(
|
OrderedFloat(
|
||||||
2.0,
|
2.0,
|
||||||
|
@ -448,59 +440,43 @@ fn parse_example() {
|
||||||
[salsa id]: 0,
|
[salsa id]: 0,
|
||||||
statements: [
|
statements: [
|
||||||
Statement {
|
Statement {
|
||||||
span: Span(
|
span: Span {
|
||||||
Id {
|
[salsa id]: 9,
|
||||||
value: 10,
|
},
|
||||||
},
|
|
||||||
),
|
|
||||||
data: Function(
|
data: Function(
|
||||||
Function(
|
Function {
|
||||||
Id {
|
[salsa id]: 0,
|
||||||
value: 1,
|
},
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
Statement {
|
Statement {
|
||||||
span: Span(
|
span: Span {
|
||||||
Id {
|
[salsa id]: 21,
|
||||||
value: 22,
|
},
|
||||||
},
|
|
||||||
),
|
|
||||||
data: Function(
|
data: Function(
|
||||||
Function(
|
Function {
|
||||||
Id {
|
[salsa id]: 1,
|
||||||
value: 2,
|
},
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
Statement {
|
Statement {
|
||||||
span: Span(
|
span: Span {
|
||||||
Id {
|
[salsa id]: 28,
|
||||||
value: 29,
|
},
|
||||||
},
|
|
||||||
),
|
|
||||||
data: Print(
|
data: Print(
|
||||||
Expression {
|
Expression {
|
||||||
span: Span(
|
span: Span {
|
||||||
Id {
|
[salsa id]: 27,
|
||||||
value: 28,
|
},
|
||||||
},
|
|
||||||
),
|
|
||||||
data: Call(
|
data: Call(
|
||||||
FunctionId(
|
FunctionId {
|
||||||
Id {
|
[salsa id]: 0,
|
||||||
value: 1,
|
},
|
||||||
},
|
|
||||||
),
|
|
||||||
[
|
[
|
||||||
Expression {
|
Expression {
|
||||||
span: Span(
|
span: Span {
|
||||||
Id {
|
[salsa id]: 23,
|
||||||
value: 24,
|
},
|
||||||
},
|
|
||||||
),
|
|
||||||
data: Number(
|
data: Number(
|
||||||
OrderedFloat(
|
OrderedFloat(
|
||||||
3.0,
|
3.0,
|
||||||
|
@ -508,11 +484,9 @@ fn parse_example() {
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
Expression {
|
Expression {
|
||||||
span: Span(
|
span: Span {
|
||||||
Id {
|
[salsa id]: 25,
|
||||||
value: 26,
|
},
|
||||||
},
|
|
||||||
),
|
|
||||||
data: Number(
|
data: Number(
|
||||||
OrderedFloat(
|
OrderedFloat(
|
||||||
4.0,
|
4.0,
|
||||||
|
@ -525,31 +499,23 @@ fn parse_example() {
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
Statement {
|
Statement {
|
||||||
span: Span(
|
span: Span {
|
||||||
Id {
|
[salsa id]: 33,
|
||||||
value: 34,
|
},
|
||||||
},
|
|
||||||
),
|
|
||||||
data: Print(
|
data: Print(
|
||||||
Expression {
|
Expression {
|
||||||
span: Span(
|
span: Span {
|
||||||
Id {
|
[salsa id]: 32,
|
||||||
value: 33,
|
},
|
||||||
},
|
|
||||||
),
|
|
||||||
data: Call(
|
data: Call(
|
||||||
FunctionId(
|
FunctionId {
|
||||||
Id {
|
[salsa id]: 1,
|
||||||
value: 2,
|
},
|
||||||
},
|
|
||||||
),
|
|
||||||
[
|
[
|
||||||
Expression {
|
Expression {
|
||||||
span: Span(
|
span: Span {
|
||||||
Id {
|
[salsa id]: 30,
|
||||||
value: 31,
|
},
|
||||||
},
|
|
||||||
),
|
|
||||||
data: Number(
|
data: Number(
|
||||||
OrderedFloat(
|
OrderedFloat(
|
||||||
1.0,
|
1.0,
|
||||||
|
@ -562,25 +528,19 @@ fn parse_example() {
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
Statement {
|
Statement {
|
||||||
span: Span(
|
span: Span {
|
||||||
Id {
|
[salsa id]: 38,
|
||||||
value: 39,
|
},
|
||||||
},
|
|
||||||
),
|
|
||||||
data: Print(
|
data: Print(
|
||||||
Expression {
|
Expression {
|
||||||
span: Span(
|
span: Span {
|
||||||
Id {
|
[salsa id]: 37,
|
||||||
value: 38,
|
},
|
||||||
},
|
|
||||||
),
|
|
||||||
data: Op(
|
data: Op(
|
||||||
Expression {
|
Expression {
|
||||||
span: Span(
|
span: Span {
|
||||||
Id {
|
[salsa id]: 34,
|
||||||
value: 35,
|
},
|
||||||
},
|
|
||||||
),
|
|
||||||
data: Number(
|
data: Number(
|
||||||
OrderedFloat(
|
OrderedFloat(
|
||||||
11.0,
|
11.0,
|
||||||
|
@ -589,11 +549,9 @@ fn parse_example() {
|
||||||
},
|
},
|
||||||
Multiply,
|
Multiply,
|
||||||
Expression {
|
Expression {
|
||||||
span: Span(
|
span: Span {
|
||||||
Id {
|
[salsa id]: 36,
|
||||||
value: 37,
|
},
|
||||||
},
|
|
||||||
),
|
|
||||||
data: Number(
|
data: Number(
|
||||||
OrderedFloat(
|
OrderedFloat(
|
||||||
2.0,
|
2.0,
|
||||||
|
@ -644,32 +602,24 @@ fn parse_precedence() {
|
||||||
[salsa id]: 0,
|
[salsa id]: 0,
|
||||||
statements: [
|
statements: [
|
||||||
Statement {
|
Statement {
|
||||||
span: Span(
|
span: Span {
|
||||||
Id {
|
[salsa id]: 10,
|
||||||
value: 11,
|
},
|
||||||
},
|
|
||||||
),
|
|
||||||
data: Print(
|
data: Print(
|
||||||
Expression {
|
Expression {
|
||||||
span: Span(
|
span: Span {
|
||||||
Id {
|
[salsa id]: 9,
|
||||||
value: 10,
|
},
|
||||||
},
|
|
||||||
),
|
|
||||||
data: Op(
|
data: Op(
|
||||||
Expression {
|
Expression {
|
||||||
span: Span(
|
span: Span {
|
||||||
Id {
|
[salsa id]: 6,
|
||||||
value: 7,
|
},
|
||||||
},
|
|
||||||
),
|
|
||||||
data: Op(
|
data: Op(
|
||||||
Expression {
|
Expression {
|
||||||
span: Span(
|
span: Span {
|
||||||
Id {
|
[salsa id]: 0,
|
||||||
value: 1,
|
},
|
||||||
},
|
|
||||||
),
|
|
||||||
data: Number(
|
data: Number(
|
||||||
OrderedFloat(
|
OrderedFloat(
|
||||||
1.0,
|
1.0,
|
||||||
|
@ -678,18 +628,14 @@ fn parse_precedence() {
|
||||||
},
|
},
|
||||||
Add,
|
Add,
|
||||||
Expression {
|
Expression {
|
||||||
span: Span(
|
span: Span {
|
||||||
Id {
|
[salsa id]: 5,
|
||||||
value: 6,
|
},
|
||||||
},
|
|
||||||
),
|
|
||||||
data: Op(
|
data: Op(
|
||||||
Expression {
|
Expression {
|
||||||
span: Span(
|
span: Span {
|
||||||
Id {
|
[salsa id]: 2,
|
||||||
value: 3,
|
},
|
||||||
},
|
|
||||||
),
|
|
||||||
data: Number(
|
data: Number(
|
||||||
OrderedFloat(
|
OrderedFloat(
|
||||||
2.0,
|
2.0,
|
||||||
|
@ -698,11 +644,9 @@ fn parse_precedence() {
|
||||||
},
|
},
|
||||||
Multiply,
|
Multiply,
|
||||||
Expression {
|
Expression {
|
||||||
span: Span(
|
span: Span {
|
||||||
Id {
|
[salsa id]: 4,
|
||||||
value: 5,
|
},
|
||||||
},
|
|
||||||
),
|
|
||||||
data: Number(
|
data: Number(
|
||||||
OrderedFloat(
|
OrderedFloat(
|
||||||
3.0,
|
3.0,
|
||||||
|
@ -715,11 +659,9 @@ fn parse_precedence() {
|
||||||
},
|
},
|
||||||
Add,
|
Add,
|
||||||
Expression {
|
Expression {
|
||||||
span: Span(
|
span: Span {
|
||||||
Id {
|
[salsa id]: 8,
|
||||||
value: 9,
|
},
|
||||||
},
|
|
||||||
),
|
|
||||||
data: Number(
|
data: Number(
|
||||||
OrderedFloat(
|
OrderedFloat(
|
||||||
4.0,
|
4.0,
|
||||||
|
|
|
@ -75,9 +75,9 @@ fn test1() {
|
||||||
assert_eq!(compute(&db, l2), 2);
|
assert_eq!(compute(&db, l2), 2);
|
||||||
db.assert_logs(expect![[r#"
|
db.assert_logs(expect![[r#"
|
||||||
[
|
[
|
||||||
"compute(List(Id { value: 2 }))",
|
"compute(List { [salsa id]: 1 })",
|
||||||
"accumulated(List(Id { value: 1 }))",
|
"accumulated(List { [salsa id]: 0 })",
|
||||||
"compute(List(Id { value: 1 }))",
|
"compute(List { [salsa id]: 0 })",
|
||||||
]"#]]);
|
]"#]]);
|
||||||
|
|
||||||
// When we mutate `l1`, we should re-execute `compute` for `l1`,
|
// When we mutate `l1`, we should re-execute `compute` for `l1`,
|
||||||
|
@ -87,7 +87,7 @@ fn test1() {
|
||||||
assert_eq!(compute(&db, l2), 2);
|
assert_eq!(compute(&db, l2), 2);
|
||||||
db.assert_logs(expect![[r#"
|
db.assert_logs(expect![[r#"
|
||||||
[
|
[
|
||||||
"accumulated(List(Id { value: 1 }))",
|
"accumulated(List { [salsa id]: 0 })",
|
||||||
"compute(List(Id { value: 1 }))",
|
"compute(List { [salsa id]: 0 })",
|
||||||
]"#]]);
|
]"#]]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,8 +70,8 @@ fn test1() {
|
||||||
assert_eq!(compute(&db, l2), 2);
|
assert_eq!(compute(&db, l2), 2);
|
||||||
db.assert_logs(expect![[r#"
|
db.assert_logs(expect![[r#"
|
||||||
[
|
[
|
||||||
"compute(List(Id { value: 2 }))",
|
"compute(List { [salsa id]: 1 })",
|
||||||
"compute(List(Id { value: 1 }))",
|
"compute(List { [salsa id]: 0 })",
|
||||||
]"#]]);
|
]"#]]);
|
||||||
|
|
||||||
// When we mutate `l1`, we should re-execute `compute` for `l1`,
|
// When we mutate `l1`, we should re-execute `compute` for `l1`,
|
||||||
|
@ -82,7 +82,7 @@ fn test1() {
|
||||||
assert_eq!(compute(&db, l2), 2);
|
assert_eq!(compute(&db, l2), 2);
|
||||||
db.assert_logs(expect![[r#"
|
db.assert_logs(expect![[r#"
|
||||||
[
|
[
|
||||||
"compute(List(Id { value: 2 }))",
|
"compute(List { [salsa id]: 1 })",
|
||||||
"compute(List(Id { value: 1 }))",
|
"compute(List { [salsa id]: 0 })",
|
||||||
]"#]]);
|
]"#]]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,8 +95,8 @@ fn basic() {
|
||||||
assert_eq!(final_result(&db, input), 2 * 2 + 2);
|
assert_eq!(final_result(&db, input), 2 * 2 + 2);
|
||||||
db.assert_logs(expect![[r#"
|
db.assert_logs(expect![[r#"
|
||||||
[
|
[
|
||||||
"final_result(MyInput(Id { value: 1 }))",
|
"final_result(MyInput { [salsa id]: 0 })",
|
||||||
"intermediate_result(MyInput(Id { value: 1 }))",
|
"intermediate_result(MyInput { [salsa id]: 0 })",
|
||||||
]"#]]);
|
]"#]]);
|
||||||
|
|
||||||
// Creates only 2 tracked structs in this revision, should delete 1
|
// Creates only 2 tracked structs in this revision, should delete 1
|
||||||
|
@ -117,12 +117,12 @@ fn basic() {
|
||||||
assert_eq!(final_result(&db, input), 2);
|
assert_eq!(final_result(&db, input), 2);
|
||||||
db.assert_logs(expect![[r#"
|
db.assert_logs(expect![[r#"
|
||||||
[
|
[
|
||||||
"intermediate_result(MyInput(Id { value: 1 }))",
|
"intermediate_result(MyInput { [salsa id]: 0 })",
|
||||||
"salsa_event(WillDiscardStaleOutput { execute_key: create_tracked_structs(0), output_key: MyTracked(2) })",
|
"salsa_event(WillDiscardStaleOutput { execute_key: create_tracked_structs(0), output_key: MyTracked(2) })",
|
||||||
"salsa_event(DidDiscard { key: MyTracked(2) })",
|
"salsa_event(DidDiscard { key: MyTracked(2) })",
|
||||||
"salsa_event(DidDiscard { key: contribution_from_struct(2) })",
|
"salsa_event(DidDiscard { key: contribution_from_struct(2) })",
|
||||||
"salsa_event(DidDiscard { key: MyTracked(5) })",
|
"salsa_event(DidDiscard { key: MyTracked(5) })",
|
||||||
"salsa_event(DidDiscard { key: copy_field(5) })",
|
"salsa_event(DidDiscard { key: copy_field(5) })",
|
||||||
"final_result(MyInput(Id { value: 1 }))",
|
"final_result(MyInput { [salsa id]: 0 })",
|
||||||
]"#]]);
|
]"#]]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,8 +88,8 @@ fn basic() {
|
||||||
assert_eq!(final_result(&db, input), 2 * 2 + 2);
|
assert_eq!(final_result(&db, input), 2 * 2 + 2);
|
||||||
db.assert_logs(expect![[r#"
|
db.assert_logs(expect![[r#"
|
||||||
[
|
[
|
||||||
"final_result(MyInput(Id { value: 1 }))",
|
"final_result(MyInput { [salsa id]: 0 })",
|
||||||
"intermediate_result(MyInput(Id { value: 1 }))",
|
"intermediate_result(MyInput { [salsa id]: 0 })",
|
||||||
]"#]]);
|
]"#]]);
|
||||||
|
|
||||||
// Creates only 2 tracked structs in this revision, should delete 1
|
// Creates only 2 tracked structs in this revision, should delete 1
|
||||||
|
@ -103,10 +103,10 @@ fn basic() {
|
||||||
assert_eq!(final_result(&db, input), 2);
|
assert_eq!(final_result(&db, input), 2);
|
||||||
db.assert_logs(expect![[r#"
|
db.assert_logs(expect![[r#"
|
||||||
[
|
[
|
||||||
"intermediate_result(MyInput(Id { value: 1 }))",
|
"intermediate_result(MyInput { [salsa id]: 0 })",
|
||||||
"salsa_event(WillDiscardStaleOutput { execute_key: create_tracked_structs(0), output_key: MyTracked(2) })",
|
"salsa_event(WillDiscardStaleOutput { execute_key: create_tracked_structs(0), output_key: MyTracked(2) })",
|
||||||
"salsa_event(DidDiscard { key: MyTracked(2) })",
|
"salsa_event(DidDiscard { key: MyTracked(2) })",
|
||||||
"salsa_event(DidDiscard { key: contribution_from_struct(2) })",
|
"salsa_event(DidDiscard { key: contribution_from_struct(2) })",
|
||||||
"final_result(MyInput(Id { value: 1 }))",
|
"final_result(MyInput { [salsa id]: 0 })",
|
||||||
]"#]]);
|
]"#]]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,13 +78,13 @@ fn execute() {
|
||||||
assert_eq!(final_result_depends_on_x(&db, input), 22);
|
assert_eq!(final_result_depends_on_x(&db, input), 22);
|
||||||
db.assert_logs(expect![[r#"
|
db.assert_logs(expect![[r#"
|
||||||
[
|
[
|
||||||
"final_result_depends_on_x(MyInput(Id { value: 1 }))",
|
"final_result_depends_on_x(MyInput { [salsa id]: 0 })",
|
||||||
]"#]]);
|
]"#]]);
|
||||||
|
|
||||||
assert_eq!(final_result_depends_on_y(&db, input), 22);
|
assert_eq!(final_result_depends_on_y(&db, input), 22);
|
||||||
db.assert_logs(expect![[r#"
|
db.assert_logs(expect![[r#"
|
||||||
[
|
[
|
||||||
"final_result_depends_on_y(MyInput(Id { value: 1 }))",
|
"final_result_depends_on_y(MyInput { [salsa id]: 0 })",
|
||||||
]"#]]);
|
]"#]]);
|
||||||
|
|
||||||
input.set_field(&mut db).to(23);
|
input.set_field(&mut db).to(23);
|
||||||
|
@ -94,7 +94,7 @@ fn execute() {
|
||||||
assert_eq!(final_result_depends_on_x(&db, input), 24);
|
assert_eq!(final_result_depends_on_x(&db, input), 24);
|
||||||
db.assert_logs(expect![[r#"
|
db.assert_logs(expect![[r#"
|
||||||
[
|
[
|
||||||
"final_result_depends_on_x(MyInput(Id { value: 1 }))",
|
"final_result_depends_on_x(MyInput { [salsa id]: 0 })",
|
||||||
]"#]]);
|
]"#]]);
|
||||||
|
|
||||||
// y = 23 / 2 = 11
|
// y = 23 / 2 = 11
|
||||||
|
|
|
@ -57,13 +57,13 @@ fn execute() {
|
||||||
assert_eq!(result_depends_on_x(&db, input), 23);
|
assert_eq!(result_depends_on_x(&db, input), 23);
|
||||||
db.assert_logs(expect![[r#"
|
db.assert_logs(expect![[r#"
|
||||||
[
|
[
|
||||||
"result_depends_on_x(MyInput(Id { value: 1 }))",
|
"result_depends_on_x(MyInput { [salsa id]: 0 })",
|
||||||
]"#]]);
|
]"#]]);
|
||||||
|
|
||||||
assert_eq!(result_depends_on_y(&db, input), 32);
|
assert_eq!(result_depends_on_y(&db, input), 32);
|
||||||
db.assert_logs(expect![[r#"
|
db.assert_logs(expect![[r#"
|
||||||
[
|
[
|
||||||
"result_depends_on_y(MyInput(Id { value: 1 }))",
|
"result_depends_on_y(MyInput { [salsa id]: 0 })",
|
||||||
]"#]]);
|
]"#]]);
|
||||||
|
|
||||||
input.set_x(&mut db).to(23);
|
input.set_x(&mut db).to(23);
|
||||||
|
@ -71,7 +71,7 @@ fn execute() {
|
||||||
assert_eq!(result_depends_on_x(&db, input), 24);
|
assert_eq!(result_depends_on_x(&db, input), 24);
|
||||||
db.assert_logs(expect![[r#"
|
db.assert_logs(expect![[r#"
|
||||||
[
|
[
|
||||||
"result_depends_on_x(MyInput(Id { value: 1 }))",
|
"result_depends_on_x(MyInput { [salsa id]: 0 })",
|
||||||
]"#]]);
|
]"#]]);
|
||||||
|
|
||||||
// input y is the same, so result depends on y
|
// input y is the same, so result depends on y
|
||||||
|
|
|
@ -58,8 +58,8 @@ fn execute() {
|
||||||
assert_eq!(final_result(&db, input), 22);
|
assert_eq!(final_result(&db, input), 22);
|
||||||
db.assert_logs(expect![[r#"
|
db.assert_logs(expect![[r#"
|
||||||
[
|
[
|
||||||
"final_result(MyInput(Id { value: 1 }))",
|
"final_result(MyInput { [salsa id]: 0 })",
|
||||||
"intermediate_result(MyInput(Id { value: 1 }))",
|
"intermediate_result(MyInput { [salsa id]: 0 })",
|
||||||
]"#]]);
|
]"#]]);
|
||||||
|
|
||||||
// Intermediate result is the same, so final result does
|
// Intermediate result is the same, so final result does
|
||||||
|
@ -68,15 +68,15 @@ fn execute() {
|
||||||
assert_eq!(final_result(&db, input), 22);
|
assert_eq!(final_result(&db, input), 22);
|
||||||
db.assert_logs(expect![[r#"
|
db.assert_logs(expect![[r#"
|
||||||
[
|
[
|
||||||
"intermediate_result(MyInput(Id { value: 1 }))",
|
"intermediate_result(MyInput { [salsa id]: 0 })",
|
||||||
]"#]]);
|
]"#]]);
|
||||||
|
|
||||||
input.set_field(&mut db).to(24);
|
input.set_field(&mut db).to(24);
|
||||||
assert_eq!(final_result(&db, input), 24);
|
assert_eq!(final_result(&db, input), 24);
|
||||||
db.assert_logs(expect![[r#"
|
db.assert_logs(expect![[r#"
|
||||||
[
|
[
|
||||||
"intermediate_result(MyInput(Id { value: 1 }))",
|
"intermediate_result(MyInput { [salsa id]: 0 })",
|
||||||
"final_result(MyInput(Id { value: 1 }))",
|
"final_result(MyInput { [salsa id]: 0 })",
|
||||||
]"#]]);
|
]"#]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,8 +89,8 @@ fn red_herring() {
|
||||||
assert_eq!(final_result(&db, input), 22);
|
assert_eq!(final_result(&db, input), 22);
|
||||||
db.assert_logs(expect![[r#"
|
db.assert_logs(expect![[r#"
|
||||||
[
|
[
|
||||||
"final_result(MyInput(Id { value: 1 }))",
|
"final_result(MyInput { [salsa id]: 0 })",
|
||||||
"intermediate_result(MyInput(Id { value: 1 }))",
|
"intermediate_result(MyInput { [salsa id]: 0 })",
|
||||||
]"#]]);
|
]"#]]);
|
||||||
|
|
||||||
// Create a distinct input and mutate it.
|
// Create a distinct input and mutate it.
|
||||||
|
|
|
@ -95,13 +95,13 @@ fn test_run_0() {
|
||||||
[
|
[
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: final_result(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: final_result(0) } }",
|
||||||
"final_result(MyInput(Id { value: 1 }))",
|
"final_result(MyInput { [salsa id]: 0 })",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: create_tracked(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: create_tracked(0) } }",
|
||||||
"create_tracked(MyInput(Id { value: 1 }))",
|
"create_tracked(MyInput { [salsa id]: 0 })",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: read_maybe_specified(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: read_maybe_specified(0) } }",
|
||||||
"read_maybe_specified(MyTracked(Id { value: 1 }))",
|
"read_maybe_specified(MyTracked { [salsa id]: 0 })",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
]"#]]);
|
]"#]]);
|
||||||
}
|
}
|
||||||
|
@ -116,13 +116,13 @@ fn test_run_5() {
|
||||||
[
|
[
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: final_result(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: final_result(0) } }",
|
||||||
"final_result(MyInput(Id { value: 1 }))",
|
"final_result(MyInput { [salsa id]: 0 })",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: create_tracked(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: create_tracked(0) } }",
|
||||||
"create_tracked(MyInput(Id { value: 1 }))",
|
"create_tracked(MyInput { [salsa id]: 0 })",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: read_maybe_specified(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: read_maybe_specified(0) } }",
|
||||||
"read_maybe_specified(MyTracked(Id { value: 1 }))",
|
"read_maybe_specified(MyTracked { [salsa id]: 0 })",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
]"#]]);
|
]"#]]);
|
||||||
}
|
}
|
||||||
|
@ -137,16 +137,16 @@ fn test_run_10() {
|
||||||
[
|
[
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: final_result(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: final_result(0) } }",
|
||||||
"final_result(MyInput(Id { value: 1 }))",
|
"final_result(MyInput { [salsa id]: 0 })",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: create_tracked(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: create_tracked(0) } }",
|
||||||
"create_tracked(MyInput(Id { value: 1 }))",
|
"create_tracked(MyInput { [salsa id]: 0 })",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: read_maybe_specified(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: read_maybe_specified(0) } }",
|
||||||
"read_maybe_specified(MyTracked(Id { value: 1 }))",
|
"read_maybe_specified(MyTracked { [salsa id]: 0 })",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: maybe_specified(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: maybe_specified(0) } }",
|
||||||
"maybe_specified(MyTracked(Id { value: 1 }))",
|
"maybe_specified(MyTracked { [salsa id]: 0 })",
|
||||||
]"#]]);
|
]"#]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,16 +160,16 @@ fn test_run_20() {
|
||||||
[
|
[
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: final_result(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: final_result(0) } }",
|
||||||
"final_result(MyInput(Id { value: 1 }))",
|
"final_result(MyInput { [salsa id]: 0 })",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: create_tracked(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: create_tracked(0) } }",
|
||||||
"create_tracked(MyInput(Id { value: 1 }))",
|
"create_tracked(MyInput { [salsa id]: 0 })",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: read_maybe_specified(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: read_maybe_specified(0) } }",
|
||||||
"read_maybe_specified(MyTracked(Id { value: 1 }))",
|
"read_maybe_specified(MyTracked { [salsa id]: 0 })",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: maybe_specified(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: maybe_specified(0) } }",
|
||||||
"maybe_specified(MyTracked(Id { value: 1 }))",
|
"maybe_specified(MyTracked { [salsa id]: 0 })",
|
||||||
]"#]]);
|
]"#]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,13 +187,13 @@ fn test_run_0_then_5_then_20() {
|
||||||
[
|
[
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: final_result(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: final_result(0) } }",
|
||||||
"final_result(MyInput(Id { value: 1 }))",
|
"final_result(MyInput { [salsa id]: 0 })",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: create_tracked(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: create_tracked(0) } }",
|
||||||
"create_tracked(MyInput(Id { value: 1 }))",
|
"create_tracked(MyInput { [salsa id]: 0 })",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: read_maybe_specified(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: read_maybe_specified(0) } }",
|
||||||
"read_maybe_specified(MyTracked(Id { value: 1 }))",
|
"read_maybe_specified(MyTracked { [salsa id]: 0 })",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
]"#]]);
|
]"#]]);
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ fn test_run_0_then_5_then_20() {
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: create_tracked(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: create_tracked(0) } }",
|
||||||
"create_tracked(MyInput(Id { value: 1 }))",
|
"create_tracked(MyInput { [salsa id]: 0 })",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: DidValidateMemoizedValue { database_key: read_maybe_specified(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: DidValidateMemoizedValue { database_key: read_maybe_specified(0) } }",
|
||||||
|
@ -227,17 +227,17 @@ fn test_run_0_then_5_then_20() {
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: create_tracked(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: create_tracked(0) } }",
|
||||||
"create_tracked(MyInput(Id { value: 1 }))",
|
"create_tracked(MyInput { [salsa id]: 0 })",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillDiscardStaleOutput { execute_key: create_tracked(0), output_key: maybe_specified(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillDiscardStaleOutput { execute_key: create_tracked(0), output_key: maybe_specified(0) } }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: maybe_specified(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: maybe_specified(0) } }",
|
||||||
"maybe_specified(MyTracked(Id { value: 1 }))",
|
"maybe_specified(MyTracked { [salsa id]: 0 })",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: read_maybe_specified(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: read_maybe_specified(0) } }",
|
||||||
"read_maybe_specified(MyTracked(Id { value: 1 }))",
|
"read_maybe_specified(MyTracked { [salsa id]: 0 })",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: final_result(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: final_result(0) } }",
|
||||||
"final_result(MyInput(Id { value: 1 }))",
|
"final_result(MyInput { [salsa id]: 0 })",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
]"#]]);
|
]"#]]);
|
||||||
|
@ -257,13 +257,13 @@ fn test_run_0_then_5_then_10_then_20() {
|
||||||
[
|
[
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: final_result(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: final_result(0) } }",
|
||||||
"final_result(MyInput(Id { value: 1 }))",
|
"final_result(MyInput { [salsa id]: 0 })",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: create_tracked(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: create_tracked(0) } }",
|
||||||
"create_tracked(MyInput(Id { value: 1 }))",
|
"create_tracked(MyInput { [salsa id]: 0 })",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: read_maybe_specified(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: read_maybe_specified(0) } }",
|
||||||
"read_maybe_specified(MyTracked(Id { value: 1 }))",
|
"read_maybe_specified(MyTracked { [salsa id]: 0 })",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
]"#]]);
|
]"#]]);
|
||||||
|
|
||||||
|
@ -278,7 +278,7 @@ fn test_run_0_then_5_then_10_then_20() {
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: create_tracked(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: create_tracked(0) } }",
|
||||||
"create_tracked(MyInput(Id { value: 1 }))",
|
"create_tracked(MyInput { [salsa id]: 0 })",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: DidValidateMemoizedValue { database_key: read_maybe_specified(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: DidValidateMemoizedValue { database_key: read_maybe_specified(0) } }",
|
||||||
|
@ -297,12 +297,12 @@ fn test_run_0_then_5_then_10_then_20() {
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: create_tracked(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: create_tracked(0) } }",
|
||||||
"create_tracked(MyInput(Id { value: 1 }))",
|
"create_tracked(MyInput { [salsa id]: 0 })",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillDiscardStaleOutput { execute_key: create_tracked(0), output_key: maybe_specified(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillDiscardStaleOutput { execute_key: create_tracked(0), output_key: maybe_specified(0) } }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: maybe_specified(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: maybe_specified(0) } }",
|
||||||
"maybe_specified(MyTracked(Id { value: 1 }))",
|
"maybe_specified(MyTracked { [salsa id]: 0 })",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: DidValidateMemoizedValue { database_key: read_maybe_specified(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: DidValidateMemoizedValue { database_key: read_maybe_specified(0) } }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: DidValidateMemoizedValue { database_key: final_result(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: DidValidateMemoizedValue { database_key: final_result(0) } }",
|
||||||
]"#]]);
|
]"#]]);
|
||||||
|
@ -317,16 +317,16 @@ fn test_run_0_then_5_then_10_then_20() {
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: create_tracked(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: create_tracked(0) } }",
|
||||||
"create_tracked(MyInput(Id { value: 1 }))",
|
"create_tracked(MyInput { [salsa id]: 0 })",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: maybe_specified(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: maybe_specified(0) } }",
|
||||||
"maybe_specified(MyTracked(Id { value: 1 }))",
|
"maybe_specified(MyTracked { [salsa id]: 0 })",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: read_maybe_specified(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: read_maybe_specified(0) } }",
|
||||||
"read_maybe_specified(MyTracked(Id { value: 1 }))",
|
"read_maybe_specified(MyTracked { [salsa id]: 0 })",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: final_result(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: final_result(0) } }",
|
||||||
"final_result(MyInput(Id { value: 1 }))",
|
"final_result(MyInput { [salsa id]: 0 })",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
]"#]]);
|
]"#]]);
|
||||||
|
@ -342,13 +342,13 @@ fn test_run_5_then_20() {
|
||||||
[
|
[
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: final_result(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: final_result(0) } }",
|
||||||
"final_result(MyInput(Id { value: 1 }))",
|
"final_result(MyInput { [salsa id]: 0 })",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: create_tracked(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: create_tracked(0) } }",
|
||||||
"create_tracked(MyInput(Id { value: 1 }))",
|
"create_tracked(MyInput { [salsa id]: 0 })",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: read_maybe_specified(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: read_maybe_specified(0) } }",
|
||||||
"read_maybe_specified(MyTracked(Id { value: 1 }))",
|
"read_maybe_specified(MyTracked { [salsa id]: 0 })",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
]"#]]);
|
]"#]]);
|
||||||
|
|
||||||
|
@ -359,17 +359,17 @@ fn test_run_5_then_20() {
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: create_tracked(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: create_tracked(0) } }",
|
||||||
"create_tracked(MyInput(Id { value: 1 }))",
|
"create_tracked(MyInput { [salsa id]: 0 })",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillDiscardStaleOutput { execute_key: create_tracked(0), output_key: maybe_specified(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillDiscardStaleOutput { execute_key: create_tracked(0), output_key: maybe_specified(0) } }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: maybe_specified(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: maybe_specified(0) } }",
|
||||||
"maybe_specified(MyTracked(Id { value: 1 }))",
|
"maybe_specified(MyTracked { [salsa id]: 0 })",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: read_maybe_specified(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: read_maybe_specified(0) } }",
|
||||||
"read_maybe_specified(MyTracked(Id { value: 1 }))",
|
"read_maybe_specified(MyTracked { [salsa id]: 0 })",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: final_result(0) } }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillExecute { database_key: final_result(0) } }",
|
||||||
"final_result(MyInput(Id { value: 1 }))",
|
"final_result(MyInput { [salsa id]: 0 })",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
"Event { runtime_id: RuntimeId { counter: 0 }, kind: WillCheckCancellation }",
|
||||||
]"#]]);
|
]"#]]);
|
||||||
|
|
|
@ -59,8 +59,8 @@ fn one_entity() {
|
||||||
assert_eq!(final_result(&db, input), 22);
|
assert_eq!(final_result(&db, input), 22);
|
||||||
db.assert_logs(expect![[r#"
|
db.assert_logs(expect![[r#"
|
||||||
[
|
[
|
||||||
"final_result(MyInput(Id { value: 1 }))",
|
"final_result(MyInput { [salsa id]: 0 })",
|
||||||
"intermediate_result(MyInput(Id { value: 1 }))",
|
"intermediate_result(MyInput { [salsa id]: 0 })",
|
||||||
]"#]]);
|
]"#]]);
|
||||||
|
|
||||||
// Intermediate result is the same, so final result does
|
// Intermediate result is the same, so final result does
|
||||||
|
@ -69,15 +69,15 @@ fn one_entity() {
|
||||||
assert_eq!(final_result(&db, input), 22);
|
assert_eq!(final_result(&db, input), 22);
|
||||||
db.assert_logs(expect![[r#"
|
db.assert_logs(expect![[r#"
|
||||||
[
|
[
|
||||||
"intermediate_result(MyInput(Id { value: 1 }))",
|
"intermediate_result(MyInput { [salsa id]: 0 })",
|
||||||
]"#]]);
|
]"#]]);
|
||||||
|
|
||||||
input.set_field(&mut db).to(24);
|
input.set_field(&mut db).to(24);
|
||||||
assert_eq!(final_result(&db, input), 24);
|
assert_eq!(final_result(&db, input), 24);
|
||||||
db.assert_logs(expect![[r#"
|
db.assert_logs(expect![[r#"
|
||||||
[
|
[
|
||||||
"intermediate_result(MyInput(Id { value: 1 }))",
|
"intermediate_result(MyInput { [salsa id]: 0 })",
|
||||||
"final_result(MyInput(Id { value: 1 }))",
|
"final_result(MyInput { [salsa id]: 0 })",
|
||||||
]"#]]);
|
]"#]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,8 +90,8 @@ fn red_herring() {
|
||||||
assert_eq!(final_result(&db, input), 22);
|
assert_eq!(final_result(&db, input), 22);
|
||||||
db.assert_logs(expect![[r#"
|
db.assert_logs(expect![[r#"
|
||||||
[
|
[
|
||||||
"final_result(MyInput(Id { value: 1 }))",
|
"final_result(MyInput { [salsa id]: 0 })",
|
||||||
"intermediate_result(MyInput(Id { value: 1 }))",
|
"intermediate_result(MyInput { [salsa id]: 0 })",
|
||||||
]"#]]);
|
]"#]]);
|
||||||
|
|
||||||
// Create a distinct input and mutate it.
|
// Create a distinct input and mutate it.
|
||||||
|
|
|
@ -57,10 +57,9 @@ fn execute() {
|
||||||
field: "foo",
|
field: "foo",
|
||||||
},
|
},
|
||||||
next: Next(
|
next: Next(
|
||||||
MyTracked(
|
MyTracked {
|
||||||
0x00007fc15c011010,
|
[salsa id]: 0,
|
||||||
PhantomData<&salsa_2022::tracked_struct::ValueStruct<tracked_with_struct_db::__MyTrackedConfig>>,
|
},
|
||||||
),
|
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
"#]].assert_debug_eq(&t0.debug(&db));
|
"#]].assert_debug_eq(&t0.debug(&db));
|
||||||
|
|
Loading…
Reference in a new issue