libsyntax: Implement deriving for enums with N-ary variants. r=brson

This commit is contained in:
Patrick Walton 2012-11-20 12:59:37 -08:00
parent 809bd3e5ef
commit e0876fdfc1
3 changed files with 169 additions and 41 deletions

View file

@ -0,0 +1,15 @@
#[deriving_eq]
enum Foo {
Bar(int, int),
Baz(float, float)
}
fn main() {
let a = Bar(1, 2);
let b = Bar(1, 2);
assert a == b;
assert !(a != b);
assert a.eq(&b);
assert !a.ne(&b);
}