libsyntax: Implement deriving correctly for type-parameterized structs and enums. r=brson

This commit is contained in:
Patrick Walton 2012-11-20 19:20:55 -08:00
parent 57588edf3b
commit e6d87a3ef4
3 changed files with 168 additions and 61 deletions

View file

@ -0,0 +1,17 @@
#[deriving_eq]
#[deriving_iter_bytes]
struct Foo<T> {
x: int,
y: T,
z: int
}
fn main() {
let a = Foo { x: 1, y: 2.0, z: 3 };
let b = Foo { x: 1, y: 2.0, z: 3 };
assert a == b;
assert !(a != b);
assert a.eq(&b);
assert !a.ne(&b);
}