diff options
| author | bors <bors@rust-lang.org> | 2014-06-30 05:36:25 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-06-30 05:36:25 +0000 |
| commit | e1683f50c00297e9908ae028fa1d41b9a52a6f6f (patch) | |
| tree | e1f34ea8fa1e5c887ed724e41a029cab323ad455 /src/libstd | |
| parent | e25eb6b223d86047dc807a167f3dd4bf492bbf41 (diff) | |
| parent | 55cae0a094bbdcd0e9d5e697ce4f38cbd783bbc7 (diff) | |
| download | rust-e1683f50c00297e9908ae028fa1d41b9a52a6f6f.tar.gz rust-e1683f50c00297e9908ae028fa1d41b9a52a6f6f.zip | |
auto merge of #15030 : sfackler/rust/partial-cmp, r=huonw
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`. # Note This isn't ready to merge yet since libcore tests are broken as you end up with 2 versions of `Option`. The rest should be reviewable though. RFC: 0028-partial-cmp
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/gc.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libstd/gc.rs b/src/libstd/gc.rs index 44988a23070..80f1cbe6cb2 100644 --- a/src/libstd/gc.rs +++ b/src/libstd/gc.rs @@ -24,6 +24,7 @@ use default::Default; use fmt; use hash; use kinds::marker; +use option::Option; use ops::Deref; use raw; @@ -59,6 +60,10 @@ impl<T: PartialEq + 'static> PartialEq for Gc<T> { } impl<T: PartialOrd + 'static> PartialOrd for Gc<T> { #[inline] + fn partial_cmp(&self, other: &Gc<T>) -> Option<Ordering> { + (**self).partial_cmp(&**other) + } + #[inline] fn lt(&self, other: &Gc<T>) -> bool { *(*self) < *(*other) } #[inline] fn le(&self, other: &Gc<T>) -> bool { *(*self) <= *(*other) } |
