Skip to content

Commit bb58726

Browse files
authored
Merge pull request #2950 from aytey/fix_lifetime_issue_2024
Fix temporary value lifetime in `serialize_struct`
2 parents 3f69251 + 106da49 commit bb58726

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

serde_derive/src/ser.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,7 +1235,7 @@ fn wrap_serialize_with(
12351235
#serialize_with(#(#self_var.values.#field_access, )* #serializer_var)
12361236
};
12371237

1238-
quote!({
1238+
quote!(&{
12391239
#[doc(hidden)]
12401240
struct __SerializeWith #wrapper_impl_generics #where_clause {
12411241
values: (#(&'__a #field_tys, )*),
@@ -1252,7 +1252,7 @@ fn wrap_serialize_with(
12521252
}
12531253
}
12541254

1255-
&__SerializeWith {
1255+
__SerializeWith {
12561256
values: (#(#field_exprs, )*),
12571257
phantom: _serde::__private::PhantomData::<#this_type #ty_generics>,
12581258
}

0 commit comments

Comments
 (0)