@@ -56,7 +56,7 @@ pub struct FunctionBodyData<'db> {
5656 pub expr_lookup : UnorderedHashMap < ast:: ExprPtr < ' db > , ExprId > ,
5757 pub pattern_lookup : UnorderedHashMap < ast:: PatternPtr < ' db > , PatternId > ,
5858 pub resolver_data : Arc < ResolverData < ' db > > ,
59- pub body : Arc < FunctionBody < ' db > > ,
59+ pub body : FunctionBody < ' db > ,
6060}
6161
6262unsafe impl < ' db > salsa:: Update for FunctionBodyData < ' db > {
@@ -68,7 +68,7 @@ unsafe impl<'db> salsa::Update for FunctionBodyData<'db> {
6868 let res = unsafe {
6969 Diagnostics :: maybe_update ( & mut old_value. diagnostics , new_value. diagnostics )
7070 | Arc :: maybe_update ( & mut old_value. resolver_data , new_value. resolver_data )
71- | Arc :: maybe_update ( & mut old_value. body , new_value. body )
71+ | FunctionBody :: maybe_update ( & mut old_value. body , new_value. body )
7272 } ;
7373 if res {
7474 old_value. expr_lookup = new_value. expr_lookup ;
@@ -331,14 +331,12 @@ pub trait FunctionWithBodySemantic<'db>: Database {
331331 fn function_body (
332332 & ' db self ,
333333 function_id : FunctionWithBodyId < ' db > ,
334- ) -> Maybe < Arc < FunctionBody < ' db > > > {
335- Ok ( match function_id {
336- FunctionWithBodyId :: Free ( id) => self . priv_free_function_body_data ( id) ?. body . clone ( ) ,
337- FunctionWithBodyId :: Impl ( id) => self . priv_impl_function_body_data ( id) ?. body . clone ( ) ,
338- FunctionWithBodyId :: Trait ( id) => {
339- self . priv_trait_function_body_data ( id) ?. ok_or ( DiagnosticAdded ) ?. body . clone ( )
340- }
341- } )
334+ ) -> Maybe < & ' db FunctionBody < ' db > > {
335+ match function_id {
336+ FunctionWithBodyId :: Free ( id) => self . free_function_body ( id) ,
337+ FunctionWithBodyId :: Impl ( id) => self . impl_function_body ( id) ,
338+ FunctionWithBodyId :: Trait ( id) => self . trait_function_body ( id) ?. ok_or ( DiagnosticAdded ) ,
339+ }
342340 }
343341 /// Returns the body expr of a function (with a body).
344342 fn function_body_expr (
0 commit comments