diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2012-08-27 15:04:18 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2012-08-27 15:04:47 -0700 |
| commit | 180202fa4d5db2b32216f35ec9a8b3c05252efc1 (patch) | |
| tree | 89bd1cf6f2b814dff722b1d191d95725c4ac2aa7 | |
| parent | 0c6e470a257fc546555aa10ededded4a77460a71 (diff) | |
libcore: Fix core test
| -rw-r--r-- | src/libcore/cmp.rs | 3 | ||||
| -rw-r--r-- | src/libcore/int-template.rs | 21 | ||||
| -rw-r--r-- | src/libcore/uint-template.rs | 20 |
3 files changed, 27 insertions, 17 deletions
diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs index 8ccfb6dd1f4..0f27f4ddfb1 100644 --- a/src/libcore/cmp.rs +++ b/src/libcore/cmp.rs @@ -16,14 +16,17 @@ trait Eq { pure fn eq(&&other: self) -> bool; } +#[cfg(notest)] pure fn lt<T: Ord>(v1: &T, v2: &T) -> bool { v1.lt(*v2) } +#[cfg(notest)] pure fn le<T: Ord Eq>(v1: &T, v2: &T) -> bool { v1.lt(*v2) || v1.eq(*v2) } +#[cfg(notest)] pure fn eq<T: Eq>(v1: &T, v2: &T) -> bool { v1.eq(*v2) } diff --git a/src/libcore/int-template.rs b/src/libcore/int-template.rs index 4688e38995f..953a7a9494d 100644 --- a/src/libcore/int-template.rs +++ b/src/libcore/int-template.rs @@ -1,5 +1,4 @@ import T = inst::T; -import cmp::{Eq, Ord}; import num::from_int; export min_value, max_value; @@ -63,19 +62,23 @@ pure fn abs(i: T) -> T { if is_negative(i) { -i } else { i } } -impl T: Ord { - pure fn lt(&&other: T) -> bool { - return self < other; +#[cfg(notest)] +mod impls { + import cmp::{Eq, Ord}; + + impl T: Ord { + pure fn lt(&&other: T) -> bool { + return self < other; + } } -} -impl T: Eq { - pure fn eq(&&other: T) -> bool { - return self == other; + impl T: Eq { + pure fn eq(&&other: T) -> bool { + return self == other; + } } } - impl T: num::Num { pure fn add(&&other: T) -> T { return self + other; } pure fn sub(&&other: T) -> T { return self - other; } diff --git a/src/libcore/uint-template.rs b/src/libcore/uint-template.rs index 1aa46e62825..48681661ee7 100644 --- a/src/libcore/uint-template.rs +++ b/src/libcore/uint-template.rs @@ -1,5 +1,4 @@ import T = inst::T; -import cmp::{Eq, Ord}; export min_value, max_value; export min, max; @@ -56,15 +55,20 @@ pure fn compl(i: T) -> T { max_value ^ i } -impl T: Ord { - pure fn lt(&&other: T) -> bool { - return self < other; +#[cfg(notest)] +mod impls { + import cmp::{Eq, Ord}; + + impl T: Ord { + pure fn lt(&&other: T) -> bool { + return self < other; + } } -} -impl T: Eq { - pure fn eq(&&other: T) -> bool { - return self == other; + impl T: Eq { + pure fn eq(&&other: T) -> bool { + return self == other; + } } } |
