-
-
Notifications
You must be signed in to change notification settings - Fork 841
Closed
Labels
Description
Given the following code:
#[derive(Serialize)]
struct A<T> {
b: B<T>,
}
serde generates the following bound: where T: _serde::Serialize
while I would expect it to generate where B<T>: _serde::Serialize
. Generated bound is wrong in some cases, e.g. if B
is implemented as follows:
#[derive(Serialize)]
struct B<T> {
#[serde(skip_serializing)]
b: T,
}
I'm currently writing my own custom-derive plugin for other purposes and I'm just putting the same bound on every field type. Serde, instead, uses some complex code to figure out what bounds to use and I'm curious why is it necessary.