Skip to content

Commit 13c1fa3

Browse files
committed
language changes: temporary workaround for rust-lang/rust#18738.
1 parent a4a0d41 commit 13c1fa3

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/repr.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use std::collections::TreeMap;
88
use serialize::json;
99
use serialize::json::ToJson;
1010

11-
#[deriving(Clone, PartialEq, Eq, PartialOrd, Ord)]
11+
#[deriving(Clone, PartialEq, Eq)]
1212
pub struct Slice<'a>(&'a str);
1313

1414
impl<'a> Slice<'a> {
@@ -24,6 +24,24 @@ impl<'a> Str for Slice<'a> {
2424
}
2525
}
2626

27+
// XXX Rust issue #18738, should be fine with #[deriving(PartialOrd)]
28+
impl<'a> PartialOrd for Slice<'a> {
29+
fn partial_cmp(&self, other: &Slice<'a>) -> Option<Ordering> {
30+
let Slice(lhs) = *self;
31+
let Slice(rhs) = *other;
32+
lhs.partial_cmp(rhs)
33+
}
34+
}
35+
36+
// XXX Rust issue #18738, should be fine with #[deriving(Ord)]
37+
impl<'a> Ord for Slice<'a> {
38+
fn cmp(&self, other: &Slice<'a>) -> Ordering {
39+
let Slice(lhs) = *self;
40+
let Slice(rhs) = *other;
41+
lhs.cmp(rhs)
42+
}
43+
}
44+
2745
#[deriving(PartialEq, Show, Clone)]
2846
pub enum Atom<'a> {
2947
Null,

0 commit comments

Comments
 (0)