mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-06-13 03:11:02 +00:00
Produce error about mismatched types of #[serde(with = "...")] and #[serde(default = "...")] attributes on the attribute itself
This commit is contained in:
@@ -1229,9 +1229,15 @@ fn wrap_serialize_with(
|
||||
})
|
||||
});
|
||||
|
||||
quote!({
|
||||
// If #serialize_with returns wrong type, error will be reported on here.
|
||||
// We attach span of the path to this piece so error will be reported
|
||||
// on the #[serde(with = "...")]
|
||||
// ^^^^^
|
||||
quote_spanned!(serialize_with.span()=> {
|
||||
#[doc(hidden)]
|
||||
struct __SerializeWith #wrapper_impl_generics #where_clause {
|
||||
// If #field_tys is empty, `values` does not used
|
||||
#[allow(dead_code)]
|
||||
values: (#(&'__a #field_tys, )*),
|
||||
phantom: _serde::__private::PhantomData<#this_type #ty_generics>,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user