Skip to content

Commit d25b9e9

Browse files
committed
---
yaml --- r: 57200 b: refs/heads/try c: 6d589f8 h: refs/heads/master v: v3
1 parent 6400abd commit d25b9e9

File tree

34 files changed

+554
-1605
lines changed

34 files changed

+554
-1605
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: c081ffbd1e845687202a975ea2e698b623e5722f
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 79a2b2eafc3c766cecec8a5f76317693bae9ed17
5-
refs/heads/try: 0604468fd540b4356ba28bf9a6d26b56b73d5b3b
5+
refs/heads/try: 6d589f88f79a987de61fce00f0364b4199f50c22
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libcore/char.rs

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
//! Utilities for manipulating the char type
1212
13+
use cmp::Ord;
1314
use option::{None, Option, Some};
1415
use str;
1516
use u32;
@@ -243,26 +244,26 @@ pub fn len_utf8_bytes(c: char) -> uint {
243244
else { fail!(~"invalid character!") }
244245
}
245246
246-
/**
247-
* Compare two chars
248-
*
249-
* # Return value
250-
*
251-
* -1 if a < b, 0 if a == b, +1 if a > b
252-
*/
253-
#[inline(always)]
254-
pub fn cmp(a: char, b: char) -> int {
255-
return if b > a { -1 }
256-
else if b < a { 1 }
257-
else { 0 }
258-
}
259-
260247
#[cfg(notest)]
261248
impl Eq for char {
249+
#[inline(always)]
262250
fn eq(&self, other: &char) -> bool { (*self) == (*other) }
251+
#[inline(always)]
263252
fn ne(&self, other: &char) -> bool { (*self) != (*other) }
264253
}
265254
255+
#[cfg(notest)]
256+
impl Ord for char {
257+
#[inline(always)]
258+
fn lt(&self, other: &char) -> bool { *self < *other }
259+
#[inline(always)]
260+
fn le(&self, other: &char) -> bool { *self <= *other }
261+
#[inline(always)]
262+
fn gt(&self, other: &char) -> bool { *self > *other }
263+
#[inline(always)]
264+
fn ge(&self, other: &char) -> bool { *self >= *other }
265+
}
266+
266267
#[test]
267268
fn test_is_lowercase() {
268269
assert!(is_lowercase('a'));

branches/try/src/libcore/cmp.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ totaleq_impl!(i64)
6464
totaleq_impl!(int)
6565
totaleq_impl!(uint)
6666

67+
totaleq_impl!(char)
68+
6769
#[deriving(Clone, Eq)]
6870
pub enum Ordering { Less = -1, Equal = 0, Greater = 1 }
6971

@@ -116,6 +118,8 @@ totalord_impl!(i64)
116118
totalord_impl!(int)
117119
totalord_impl!(uint)
118120

121+
totalord_impl!(char)
122+
119123
pub fn cmp2<A:TotalOrd,B:TotalOrd>(
120124
a1: &A, b1: &B,
121125
a2: &A, b2: &B) -> Ordering

branches/try/src/libcore/core.rc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ pub use kinds::{Const, Copy, Owned, Durable};
7777
pub use ops::{Drop};
7878
#[cfg(stage0)]
7979
pub use ops::{Add, Sub, Mul, Div, Modulo, Neg, Not};
80-
#[cfg(not(stage0))]
80+
#[cfg(stage1)]
81+
#[cfg(stage2)]
82+
#[cfg(stage3)]
8183
pub use ops::{Add, Sub, Mul, Quot, Rem, Neg, Not};
8284
pub use ops::{BitAnd, BitOr, BitXor};
8385
pub use ops::{Shl, Shr, Index};
@@ -103,9 +105,7 @@ pub use iter::{BaseIter, ExtendedIter, EqIter, CopyableIter};
103105
pub use iter::{CopyableOrderedIter, CopyableNonstrictIter, Times};
104106
pub use iter::{ExtendedMutableIter};
105107

106-
pub use num::{Num, NumCast};
107-
pub use num::{Signed, Unsigned, Integer};
108-
pub use num::{Round, Fractional, Real, RealExt};
108+
pub use num::{Num, Signed, Unsigned, Natural, NumCast};
109109
pub use ptr::Ptr;
110110
pub use to_str::ToStr;
111111
pub use clone::Clone;

0 commit comments

Comments
 (0)