1
Fork 0

rustc: Make < and = into traits

This commit is contained in:
Patrick Walton 2012-08-27 16:26:35 -07:00
parent 94720fcea7
commit 96534365c2
103 changed files with 2985 additions and 328 deletions

View file

@ -6,11 +6,17 @@
// Tests for if as expressions returning structural types
fn test_rec() {
let rs = if true { {i: 100} } else { {i: 101} };
assert (rs == {i: 100});
assert (rs.i == 100);
}
enum mood { happy, sad, }
impl mood : cmp::Eq {
pure fn eq(&&other: mood) -> bool {
(self as uint) == (other as uint)
}
}
fn test_tag() {
enum mood { happy, sad, }
let rs = if true { happy } else { sad };
assert (rs == happy);
}