rustc: Make <
and =
into traits
This commit is contained in:
parent
94720fcea7
commit
96534365c2
103 changed files with 2985 additions and 328 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue