Skip to content

Commit

Permalink
Merge pull request #2866 from tdittr/mark-visitors-as-generated
Browse files Browse the repository at this point in the history
Mark generated `impl de::Visitor` blocks as `#[automatically_derived]`
  • Loading branch information
oli-obk authored Dec 9, 2024
2 parents b9dbfcb + e9c399c commit 46e9ecf
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions serde_derive/src/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ fn deserialize_unit_struct(params: &Parameters, cattrs: &attr::Container) -> Fra
lifetime: _serde::__private::PhantomData<&#delife ()>,
}

#[automatically_derived]
impl #de_impl_generics _serde::de::Visitor<#delife> for __Visitor #de_ty_generics #where_clause {
type Value = #this_type #ty_generics;

Expand Down Expand Up @@ -559,6 +560,7 @@ fn deserialize_tuple(
lifetime: _serde::__private::PhantomData<&#delife ()>,
}

#[automatically_derived]
impl #de_impl_generics _serde::de::Visitor<#delife> for __Visitor #de_ty_generics #where_clause {
type Value = #this_type #ty_generics;

Expand Down Expand Up @@ -658,6 +660,7 @@ fn deserialize_tuple_in_place(
lifetime: _serde::__private::PhantomData<&#delife ()>,
}

#[automatically_derived]
impl #in_place_impl_generics _serde::de::Visitor<#delife> for __Visitor #in_place_ty_generics #where_clause {
type Value = ();

Expand Down Expand Up @@ -1020,6 +1023,7 @@ fn deserialize_struct(

let visitor_seed = match form {
StructForm::ExternallyTagged(..) if has_flatten => Some(quote! {
#[automatically_derived]
impl #de_impl_generics _serde::de::DeserializeSeed<#delife> for __Visitor #de_ty_generics #where_clause {
type Value = #this_type #ty_generics;

Expand Down Expand Up @@ -1084,6 +1088,7 @@ fn deserialize_struct(
lifetime: _serde::__private::PhantomData<&#delife ()>,
}

#[automatically_derived]
impl #de_impl_generics _serde::de::Visitor<#delife> for __Visitor #de_ty_generics #where_clause {
type Value = #this_type #ty_generics;

Expand Down Expand Up @@ -1165,6 +1170,7 @@ fn deserialize_struct_in_place(
lifetime: _serde::__private::PhantomData<&#delife ()>,
}

#[automatically_derived]
impl #in_place_impl_generics _serde::de::Visitor<#delife> for __Visitor #in_place_ty_generics #where_clause {
type Value = ();

Expand Down Expand Up @@ -1338,6 +1344,7 @@ fn deserialize_externally_tagged_enum(
lifetime: _serde::__private::PhantomData<&#delife ()>,
}

#[automatically_derived]
impl #de_impl_generics _serde::de::Visitor<#delife> for __Visitor #de_ty_generics #where_clause {
type Value = #this_type #ty_generics;

Expand Down Expand Up @@ -1618,6 +1625,7 @@ fn deserialize_adjacently_tagged_enum(
lifetime: _serde::__private::PhantomData<&#delife ()>,
}

#[automatically_derived]
impl #de_impl_generics _serde::de::Visitor<#delife> for __Visitor #de_ty_generics #where_clause {
type Value = #this_type #ty_generics;

Expand Down Expand Up @@ -2046,12 +2054,14 @@ fn deserialize_generated_identifier(
#[doc(hidden)]
struct __FieldVisitor;

#[automatically_derived]
impl<'de> _serde::de::Visitor<'de> for __FieldVisitor {
type Value = __Field #lifetime;

#visitor_impl
}

#[automatically_derived]
impl<'de> _serde::Deserialize<'de> for __Field #lifetime {
#[inline]
fn deserialize<__D>(__deserializer: __D) -> _serde::__private::Result<Self, __D::Error>
Expand Down Expand Up @@ -2190,6 +2200,7 @@ fn deserialize_custom_identifier(
lifetime: _serde::__private::PhantomData<&#delife ()>,
}

#[automatically_derived]
impl #de_impl_generics _serde::de::Visitor<#delife> for __FieldVisitor #de_ty_generics #where_clause {
type Value = #this_type #ty_generics;

Expand Down

0 comments on commit 46e9ecf

Please sign in to comment.