libcore: Fix build harder
This commit is contained in:
parent
1cd97ee47d
commit
381a628c4c
@ -4,29 +4,37 @@
|
||||
|
||||
/// Interfaces used for comparison.
|
||||
|
||||
// Awful hack to work around duplicate lang items in core test.
|
||||
#[cfg(notest)]
|
||||
#[lang="ord"]
|
||||
trait Ord {
|
||||
pure fn lt(&&other: self) -> bool;
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
trait Ord {
|
||||
pure fn lt(&&other: self) -> bool;
|
||||
}
|
||||
|
||||
#[cfg(notest)]
|
||||
#[lang="eq"]
|
||||
trait Eq {
|
||||
pure fn eq(&&other: self) -> bool;
|
||||
}
|
||||
|
||||
#[cfg(notest)]
|
||||
#[cfg(test)]
|
||||
trait Eq {
|
||||
pure fn eq(&&other: self) -> bool;
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
import T = inst::T;
|
||||
import cmp::{Eq, Ord};
|
||||
import num::from_int;
|
||||
|
||||
export min_value, max_value;
|
||||
@ -62,20 +63,15 @@ fn range(lo: T, hi: T, it: fn(T) -> bool) {
|
||||
if is_negative(i) { -i } else { i }
|
||||
}
|
||||
|
||||
#[cfg(notest)]
|
||||
mod impls {
|
||||
import cmp::{Eq, Ord};
|
||||
|
||||
impl T: Ord {
|
||||
pure fn lt(&&other: T) -> bool {
|
||||
return self < other;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import T = inst::T;
|
||||
import cmp::{Eq, Ord};
|
||||
|
||||
export min_value, max_value;
|
||||
export min, max;
|
||||
@ -55,20 +56,15 @@
|
||||
max_value ^ i
|
||||
}
|
||||
|
||||
#[cfg(notest)]
|
||||
mod impls {
|
||||
import cmp::{Eq, Ord};
|
||||
|
||||
impl T: Ord {
|
||||
pure fn lt(&&other: T) -> bool {
|
||||
return self < other;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user