Fix Into conversion involving generic remote derive with getter

This commit is contained in:
David Tolnay 2022-11-27 17:16:00 -08:00
parent 7328b34810
commit 37021910c9
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
2 changed files with 7 additions and 3 deletions

View File

@ -712,8 +712,9 @@ fn deserialize_seq(
if params.has_getter {
let this_type = &params.this_type;
let (_, ty_generics, _) = params.generics.split_for_impl();
result = quote! {
_serde::__private::Into::<#this_type>::into(#result)
_serde::__private::Into::<#this_type #ty_generics>::into(#result)
};
}
@ -856,8 +857,9 @@ fn deserialize_newtype_struct(
let mut result = quote!(#type_path(__field0));
if params.has_getter {
let this_type = &params.this_type;
let (_, ty_generics, _) = params.generics.split_for_impl();
result = quote! {
_serde::__private::Into::<#this_type>::into(#result)
_serde::__private::Into::<#this_type #ty_generics>::into(#result)
};
}
@ -2629,8 +2631,9 @@ fn deserialize_map(
let mut result = quote!(#struct_path { #(#result),* });
if params.has_getter {
let this_type = &params.this_type;
let (_, ty_generics, _) = params.generics.split_for_impl();
result = quote! {
_serde::__private::Into::<#this_type>::into(#result)
_serde::__private::Into::<#this_type #ty_generics>::into(#result)
};
}

View File

@ -80,6 +80,7 @@ mod remote {
}
impl<T> StructGeneric<T> {
#[allow(dead_code)]
pub fn get_value(&self) -> &T {
&self.value
}