Implement RFC#28: Add PartialOrd::partial_cmp

I ended up altering the semantics of Json's PartialOrd implementation.
It used to be the case that Null < Null, but I can't think of any reason
for an ordering other than the default one so I just switched it over to
using the derived implementation.

This also fixes broken `PartialOrd` implementations for `Vec` and
`TreeMap`.

RFC: 0028-partial-cmp
This commit is contained in:
Steven Fackler 2014-06-17 23:25:51 -07:00
parent bb5695b95c
commit 55cae0a094
28 changed files with 343 additions and 161 deletions

View file

@ -27,6 +27,7 @@ enum Enum {
//~^^^^^ ERROR
//~^^^^^^ ERROR
//~^^^^^^^ ERROR
//~^^^^^^^^ ERROR
}
}

View file

@ -27,6 +27,7 @@ enum Enum {
//~^^^^^ ERROR
//~^^^^^^ ERROR
//~^^^^^^^ ERROR
//~^^^^^^^^ ERROR
)
}

View file

@ -26,6 +26,7 @@ struct Struct {
//~^^^^^ ERROR
//~^^^^^^ ERROR
//~^^^^^^^ ERROR
//~^^^^^^^^ ERROR
}
fn main() {}

View file

@ -26,6 +26,7 @@ struct Struct(
//~^^^^^ ERROR
//~^^^^^^ ERROR
//~^^^^^^^ ERROR
//~^^^^^^^^ ERROR
);
fn main() {}

View file

@ -10,7 +10,7 @@
#[deriving(PartialEq)]
struct thing(uint);
impl PartialOrd for thing { //~ ERROR not all trait methods implemented, missing: `lt`
impl PartialOrd for thing { //~ ERROR not all trait methods implemented, missing: `partial_cmp`
fn le(&self, other: &thing) -> bool { true }
fn ge(&self, other: &thing) -> bool { true }
}