Closed
Description
The following will fail because the derive
will automatically add a T: Serialize/Deserialize
bound despite the attributes. It would be nice if the codegen were smart enough to figure out the bound isn't necessary.
Also note that default
is not quite correct in this test case, as it doesn't imply that the type should never be deserialized. A skip_deserializing
attribute should also exist (see also #183).
Also related: the : Default
bound should not be necessary, and automatically added to the derived impl Deserialize
in the same manner.
#![feature(plugin, custom_derive, custom_attribute)]
#![plugin(serde_macros)]
extern crate serde;
#[derive(Serialize, Deserialize)]
struct A<T: Default> {
#[serde(skip_serializing, default)]
t: T,
}
#[derive(Default)]
struct B;
fn main() {
fn assert<T: serde::Serialize + serde::Deserialize>(_: T) { }
assert(A { t: B })
}