Generate bounds on type parameters only

This commit is contained in:
David Tolnay
2016-07-21 22:51:28 -07:00
parent 49ff56aa15
commit 1831b471f9
2 changed files with 85 additions and 87 deletions
+29 -1
View File
@@ -92,6 +92,35 @@ struct ListNode<D> {
next: Box<ListNode<D>>,
}
#[derive(Serialize, Deserialize)]
struct RecursiveA {
b: Box<RecursiveB>,
}
#[derive(Serialize, Deserialize)]
enum RecursiveB {
A(RecursiveA),
}
#[derive(Serialize, Deserialize)]
struct RecursiveGenericA<T> {
t: T,
b: Box<RecursiveGenericB<T>>,
}
#[derive(Serialize, Deserialize)]
enum RecursiveGenericB<T> {
T(T),
A(RecursiveGenericA<T>),
}
#[derive(Serialize)]
#[allow(dead_code)]
struct OptionStatic<'a> {
a: Option<&'a str>,
b: Option<&'static str>,
}
#[derive(Serialize, Deserialize)]
#[serde(bound="D: SerializeWith + DeserializeWith")]
struct WithTraits1<D, E> {
@@ -132,4 +161,3 @@ trait DeserializeWith: Sized {
struct X;
fn ser_x<S: Serializer>(_: &X, _: &mut S) -> Result<(), S::Error> { panic!() }
fn de_x<D: Deserializer>(_: &mut D) -> Result<X, D::Error> { panic!() }