Open irevoire opened 2 months ago
Hello,
I noticed that the serde derive macro was incorrectly adding impl Serialize bounds to the structures that derive Serialize:
impl Serialize
Serialize
use serde::Serialize; #[derive(Debug, Serialize, Clone)] #[serde(rename_all = "camelCase")] pub struct First<Http> { second: Second<Http>, } #[derive(Debug, Serialize, Clone)] #[serde(rename_all = "camelCase")] pub struct Second<Http> { nb: usize, #[serde(skip_serializing)] http_client: Http, } pub struct Truc; fn main() { // This works, serde understands that `Http` doesn't need to implement `Serialize` let a = serde_json::to_string_pretty(&Second { nb: 1, http_client: Truc, }) .unwrap(); // This doesn't; serde derive added a bound requiring that `Http` implements `Serialize` let a = serde_json::to_string_pretty(&First { second: Second { nb: 1, http_client: Truc, }, }) .unwrap(); }
Hello,
I noticed that the serde derive macro was incorrectly adding
impl Serialize
bounds to the structures that deriveSerialize
: