Skip to content

Commit 80c71c8

Browse files
committed
add a TotalOrd impl for the unit type
1 parent eaed16c commit 80c71c8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/libcore/nil.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Functions for the unit type.
1515
*/
1616

1717
#[cfg(notest)]
18-
use cmp::{Eq, Ord};
18+
use cmp::{Eq, Ord, TotalOrd, Ordering, Equal};
1919

2020
#[cfg(notest)]
2121
impl Eq for () {
@@ -37,3 +37,8 @@ impl Ord for () {
3737
pure fn gt(&self, _other: &()) -> bool { false }
3838
}
3939

40+
#[cfg(notest)]
41+
impl TotalOrd for () {
42+
#[inline(always)]
43+
pure fn cmp(&self, _other: &()) -> Ordering { Equal }
44+
}

0 commit comments

Comments
 (0)