From 55cae0a094bbdcd0e9d5e697ce4f38cbd783bbc7 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Tue, 17 Jun 2014 23:25:51 -0700 Subject: 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 --- src/libstd/gc.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/libstd') 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; @@ -58,6 +59,10 @@ impl PartialEq for Gc { fn ne(&self, other: &Gc) -> bool { *(*self) != *(*other) } } impl PartialOrd for Gc { + #[inline] + fn partial_cmp(&self, other: &Gc) -> Option { + (**self).partial_cmp(&**other) + } #[inline] fn lt(&self, other: &Gc) -> bool { *(*self) < *(*other) } #[inline] -- cgit 1.4.1-3-g733a5