From 11b23c942bad08b5adda05fff69bf6901ba08e02 Mon Sep 17 00:00:00 2001 From: Mihail Mihov Date: Thu, 11 Aug 2022 20:27:47 +0300 Subject: [PATCH] Return old value in input setter methods --- components/salsa-2022-macros/src/input.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/salsa-2022-macros/src/input.rs b/components/salsa-2022-macros/src/input.rs index 7dc40092..f1cbdca9 100644 --- a/components/salsa-2022-macros/src/input.rs +++ b/components/salsa-2022-macros/src/input.rs @@ -93,11 +93,11 @@ impl InputStruct { let field_setters: Vec = field_indices.iter().zip(&field_names).zip(&field_tys).map(|((field_index, field_name), field_ty)| { let set_field_name = syn::Ident::new(&format!("set_{}", field_name), field_name.span()); parse_quote! { - pub fn #set_field_name<'db>(self, __db: &'db mut #db_dyn_ty, __value: #field_ty) + pub fn #set_field_name<'db>(self, __db: &'db mut #db_dyn_ty, __value: #field_ty) -> #field_ty { let (__jar, __runtime) = <_ as salsa::storage::HasJar<#jar_ty>>::jar_mut(__db); let __ingredients = <#jar_ty as salsa::storage::HasIngredientsFor< #ident >>::ingredient_mut(__jar); - __ingredients.#field_index.store(__runtime, self, __value, salsa::Durability::LOW); + __ingredients.#field_index.store(__runtime, self, __value, salsa::Durability::LOW).unwrap() } } })