Skip to content

Commit

Permalink
Fix Into conversion involving generic remote derive with getter
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Nov 28, 2022
1 parent 7328b34 commit 3702191
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
9 changes: 6 additions & 3 deletions serde_derive/src/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
};
}

Expand Down Expand Up @@ -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)
};
}

Expand Down Expand Up @@ -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)
};
}

Expand Down
1 change: 1 addition & 0 deletions test_suite/tests/test_remote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ mod remote {
}

impl<T> StructGeneric<T> {
#[allow(dead_code)]
pub fn get_value(&self) -> &T {
&self.value
}
Expand Down

0 comments on commit 3702191

Please sign in to comment.