From afd91f8a5698e7767ddfbf90c665c08dcd4f0de0 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Sun, 23 Sep 2012 22:25:43 -0700 Subject: Register snapshots. Remove redundant Eq impls, Makefile hacks --- src/libcore/at_vec.rs | 9 ---- src/libcore/bool.rs | 7 --- src/libcore/box.rs | 16 ------- src/libcore/char.rs | 7 --- src/libcore/cmp.rs | 79 ---------------------------------- src/libcore/either.rs | 22 ---------- src/libcore/extfmt.rs | 36 ---------------- src/libcore/float.rs | 16 ------- src/libcore/int-template.rs | 16 ------- src/libcore/io.rs | 12 ------ src/libcore/ops.rs | 80 ---------------------------------- src/libcore/option.rs | 22 ---------- src/libcore/path.rs | 22 ---------- src/libcore/pipes.rs | 9 ---- src/libcore/ptr.rs | 52 ---------------------- src/libcore/repr.rs | 9 ---- src/libcore/result.rs | 22 ---------- src/libcore/str.rs | 81 ---------------------------------- src/libcore/task.rs | 76 -------------------------------- src/libcore/task/local_data_priv.rs | 11 ----- src/libcore/tuple.rs | 86 ------------------------------------- src/libcore/uint-template.rs | 16 ------- src/libcore/uniq.rs | 16 ------- src/libcore/unit.rs | 16 ------- src/libcore/vec.rs | 86 ------------------------------------- 25 files changed, 824 deletions(-) (limited to 'src/libcore') diff --git a/src/libcore/at_vec.rs b/src/libcore/at_vec.rs index 1b90e25fdc1..e35e6536410 100644 --- a/src/libcore/at_vec.rs +++ b/src/libcore/at_vec.rs @@ -139,15 +139,6 @@ pure fn from_elem(n_elts: uint, t: T) -> @[T] { #[cfg(notest)] mod traits { #[legacy_exports]; - #[cfg(stage0)] - impl @[T]: Add<&[const T],@[T]> { - #[inline(always)] - pure fn add(rhs: &[const T]) -> @[T] { - append(self, rhs) - } - } - #[cfg(stage1)] - #[cfg(stage2)] impl @[T] : Add<&[const T],@[T]> { #[inline(always)] pure fn add(rhs: & &[const T]) -> @[T] { diff --git a/src/libcore/bool.rs b/src/libcore/bool.rs index a80519e82ee..1419aac6369 100644 --- a/src/libcore/bool.rs +++ b/src/libcore/bool.rs @@ -69,13 +69,6 @@ fn all_values(blk: fn(v: bool)) { /// converts truth value to an 8 bit byte pure fn to_bit(v: bool) -> u8 { if v { 1u8 } else { 0u8 } } -#[cfg(stage0)] -impl bool : cmp::Eq { - pure fn eq(&&other: bool) -> bool { self == other } - pure fn ne(&&other: bool) -> bool { self != other } -} -#[cfg(stage1)] -#[cfg(stage2)] impl bool : cmp::Eq { pure fn eq(other: &bool) -> bool { self == (*other) } pure fn ne(other: &bool) -> bool { self != (*other) } diff --git a/src/libcore/box.rs b/src/libcore/box.rs index f7db82864e6..fd3715b457c 100644 --- a/src/libcore/box.rs +++ b/src/libcore/box.rs @@ -31,27 +31,11 @@ pure fn ptr_eq(a: @T, b: @T) -> bool { unsafe { ptr::addr_of(*a) == ptr::addr_of(*b) } } -#[cfg(stage0)] -impl @const T : Eq { - pure fn eq(&&other: @const T) -> bool { *self == *other } - pure fn ne(&&other: @const T) -> bool { *self != *other } -} -#[cfg(stage1)] -#[cfg(stage2)] impl @const T : Eq { pure fn eq(other: &@const T) -> bool { *self == *(*other) } pure fn ne(other: &@const T) -> bool { *self != *(*other) } } -#[cfg(stage0)] -impl @const T : Ord { - pure fn lt(&&other: @const T) -> bool { *self < *other } - pure fn le(&&other: @const T) -> bool { *self <= *other } - pure fn ge(&&other: @const T) -> bool { *self >= *other } - pure fn gt(&&other: @const T) -> bool { *self > *other } -} -#[cfg(stage1)] -#[cfg(stage2)] impl @const T : Ord { pure fn lt(other: &@const T) -> bool { *self < *(*other) } pure fn le(other: &@const T) -> bool { *self <= *(*other) } diff --git a/src/libcore/char.rs b/src/libcore/char.rs index d7e553073bf..e6fab268a5b 100644 --- a/src/libcore/char.rs +++ b/src/libcore/char.rs @@ -185,13 +185,6 @@ pure fn cmp(a: char, b: char) -> int { else { 0 } } -#[cfg(stage0)] -impl char: Eq { - pure fn eq(&&other: char) -> bool { self == other } - pure fn ne(&&other: char) -> bool { self != other } -} -#[cfg(stage1)] -#[cfg(stage2)] impl char : Eq { pure fn eq(other: &char) -> bool { self == (*other) } pure fn ne(other: &char) -> bool { self != (*other) } diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs index 362062e945d..37a8f976d74 100644 --- a/src/libcore/cmp.rs +++ b/src/libcore/cmp.rs @@ -32,17 +32,6 @@ mod nounittest { * an `le` method, with the others generated from * default implementations. */ - #[cfg(stage0)] - #[lang="ord"] - trait Ord { - pure fn lt(&&other: self) -> bool; - pure fn le(&&other: self) -> bool; - pure fn ge(&&other: self) -> bool; - pure fn gt(&&other: self) -> bool; - } - - #[cfg(stage1)] - #[cfg(stage2)] #[lang="ord"] trait Ord { pure fn lt(other: &self) -> bool; @@ -51,7 +40,6 @@ mod nounittest { pure fn gt(other: &self) -> bool; } - #[cfg(stage0)] #[lang="eq"] /** * Trait for values that can be compared for equality @@ -61,13 +49,6 @@ mod nounittest { * an `eq` method, with the other generated from * a default implementation. */ - trait Eq { - pure fn eq(&&other: self) -> bool; - pure fn ne(&&other: self) -> bool; - } - - #[cfg(stage1)] - #[cfg(stage2)] #[lang="eq"] trait Eq { pure fn eq(other: &self) -> bool; @@ -82,16 +63,6 @@ mod nounittest { #[cfg(test)] mod unittest { #[legacy_exports]; - #[cfg(stage0)] - trait Ord { - pure fn lt(&&other: self) -> bool; - pure fn le(&&other: self) -> bool; - pure fn ge(&&other: self) -> bool; - pure fn gt(&&other: self) -> bool; - } - - #[cfg(stage1)] - #[cfg(stage2)] trait Ord { pure fn lt(other: &self) -> bool; pure fn le(other: &self) -> bool; @@ -99,14 +70,6 @@ mod unittest { pure fn gt(other: &self) -> bool; } - #[cfg(stage0)] - trait Eq { - pure fn eq(&&other: self) -> bool; - pure fn ne(&&other: self) -> bool; - } - - #[cfg(stage1)] - #[cfg(stage2)] trait Eq { pure fn eq(other: &self) -> bool; pure fn ne(other: &self) -> bool; @@ -117,68 +80,26 @@ mod unittest { mod unittest { #[legacy_exports];} -#[cfg(stage0)] -pure fn lt(v1: &T, v2: &T) -> bool { - v1.lt(v2) -} - -#[cfg(stage0)] -pure fn le(v1: &T, v2: &T) -> bool { - v1.lt(v2) || v1.eq(v2) -} - -#[cfg(stage0)] -pure fn eq(v1: &T, v2: &T) -> bool { - v1.eq(v2) -} - -#[cfg(stage0)] -pure fn ne(v1: &T, v2: &T) -> bool { - v1.ne(v2) -} - -#[cfg(stage0)] -pure fn ge(v1: &T, v2: &T) -> bool { - v1.ge(v2) -} - -#[cfg(stage0)] -pure fn gt(v1: &T, v2: &T) -> bool { - v1.gt(v2) -} - -#[cfg(stage1)] -#[cfg(stage2)] pure fn lt(v1: &T, v2: &T) -> bool { (*v1).lt(v2) } -#[cfg(stage1)] -#[cfg(stage2)] pure fn le(v1: &T, v2: &T) -> bool { (*v1).lt(v2) || (*v1).eq(v2) } -#[cfg(stage1)] -#[cfg(stage2)] pure fn eq(v1: &T, v2: &T) -> bool { (*v1).eq(v2) } -#[cfg(stage1)] -#[cfg(stage2)] pure fn ne(v1: &T, v2: &T) -> bool { (*v1).ne(v2) } -#[cfg(stage1)] -#[cfg(stage2)] pure fn ge(v1: &T, v2: &T) -> bool { (*v1).ge(v2) } -#[cfg(stage1)] -#[cfg(stage2)] pure fn gt(v1: &T, v2: &T) -> bool { (*v1).gt(v2) } diff --git a/src/libcore/either.rs b/src/libcore/either.rs index d566cd7e6dc..55e22f7cfe9 100644 --- a/src/libcore/either.rs +++ b/src/libcore/either.rs @@ -126,28 +126,6 @@ pure fn unwrap_right(+eith: Either) -> U { } } -#[cfg(stage0)] -impl Either : Eq { - pure fn eq(&&other: Either) -> bool { - match self { - Left(a) => { - match other { - Left(b) => a.eq(b), - Right(_) => false - } - } - Right(a) => { - match other { - Left(_) => false, - Right(b) => a.eq(b) - } - } - } - } - pure fn ne(&&other: Either) -> bool { !self.eq(other) } -} -#[cfg(stage1)] -#[cfg(stage2)] impl Either : Eq { pure fn eq(other: &Either) -> bool { match self { diff --git a/src/libcore/extfmt.rs b/src/libcore/extfmt.rs index 624cb97dbca..9a992143a11 100644 --- a/src/libcore/extfmt.rs +++ b/src/libcore/extfmt.rs @@ -388,24 +388,6 @@ mod rt { enum PadMode { PadSigned, PadUnsigned, PadNozero, PadFloat } -#[cfg(stage0)] - impl PadMode: Eq { - pure fn eq(&&other: PadMode) -> bool { - match (self, other) { - (PadSigned, PadSigned) => true, - (PadUnsigned, PadUnsigned) => true, - (PadNozero, PadNozero) => true, - (PadFloat, PadFloat) => true, - (PadSigned, _) => false, - (PadUnsigned, _) => false, - (PadNozero, _) => false, - (PadFloat, _) => false - } - } - pure fn ne(&&other: PadMode) -> bool { !self.eq(other) } - } - #[cfg(stage1)] - #[cfg(stage2)] impl PadMode : Eq { pure fn eq(other: &PadMode) -> bool { match (self, (*other)) { @@ -595,24 +577,6 @@ mod rt2 { enum PadMode { PadSigned, PadUnsigned, PadNozero, PadFloat } -#[cfg(stage0)] - impl PadMode: Eq { - pure fn eq(&&other: PadMode) -> bool { - match (self, other) { - (PadSigned, PadSigned) => true, - (PadUnsigned, PadUnsigned) => true, - (PadNozero, PadNozero) => true, - (PadFloat, PadFloat) => true, - (PadSigned, _) => false, - (PadUnsigned, _) => false, - (PadNozero, _) => false, - (PadFloat, _) => false - } - } - pure fn ne(&&other: PadMode) -> bool { !self.eq(other) } - } - #[cfg(stage1)] - #[cfg(stage2)] impl PadMode : Eq { pure fn eq(other: &PadMode) -> bool { match (self, (*other)) { diff --git a/src/libcore/float.rs b/src/libcore/float.rs index df28426dc3a..2cd95269aaf 100644 --- a/src/libcore/float.rs +++ b/src/libcore/float.rs @@ -415,27 +415,11 @@ pure fn sin(x: float) -> float { f64::sin(x as f64) as float } pure fn cos(x: float) -> float { f64::cos(x as f64) as float } pure fn tan(x: float) -> float { f64::tan(x as f64) as float } -#[cfg(stage0)] -impl float: Eq { - pure fn eq(&&other: float) -> bool { self == other } - pure fn ne(&&other: float) -> bool { self != other } -} -#[cfg(stage1)] -#[cfg(stage2)] impl float : Eq { pure fn eq(other: &float) -> bool { self == (*other) } pure fn ne(other: &float) -> bool { self != (*other) } } -#[cfg(stage0)] -impl float: Ord { - pure fn lt(&&other: float) -> bool { self < other } - pure fn le(&&other: float) -> bool { self <= other } - pure fn ge(&&other: float) -> bool { self >= other } - pure fn gt(&&other: float) -> bool { self > other } -} -#[cfg(stage1)] -#[cfg(stage2)] impl float : Ord { pure fn lt(other: &float) -> bool { self < (*other) } pure fn le(other: &float) -> bool { self <= (*other) } diff --git a/src/libcore/int-template.rs b/src/libcore/int-template.rs index c9dd21252a3..e1137e6d269 100644 --- a/src/libcore/int-template.rs +++ b/src/libcore/int-template.rs @@ -68,15 +68,6 @@ pure fn abs(i: T) -> T { if is_negative(i) { -i } else { i } } -#[cfg(stage0)] -impl T: Ord { - pure fn lt(&&other: T) -> bool { return self < other; } - pure fn le(&&other: T) -> bool { return self <= other; } - pure fn ge(&&other: T) -> bool { return self >= other; } - pure fn gt(&&other: T) -> bool { return self > other; } -} -#[cfg(stage1)] -#[cfg(stage2)] impl T : Ord { pure fn lt(other: &T) -> bool { return self < (*other); } pure fn le(other: &T) -> bool { return self <= (*other); } @@ -84,13 +75,6 @@ impl T : Ord { pure fn gt(other: &T) -> bool { return self > (*other); } } -#[cfg(stage0)] -impl T: Eq { - pure fn eq(&&other: T) -> bool { return self == other; } - pure fn ne(&&other: T) -> bool { return self != other; } -} -#[cfg(stage1)] -#[cfg(stage2)] impl T : Eq { pure fn eq(other: &T) -> bool { return self == (*other); } pure fn ne(other: &T) -> bool { return self != (*other); } diff --git a/src/libcore/io.rs b/src/libcore/io.rs index bc7f2c9e666..7c08e508d51 100644 --- a/src/libcore/io.rs +++ b/src/libcore/io.rs @@ -329,18 +329,6 @@ enum FileFlag { Append, Create, Truncate, NoFlag, } // What type of writer are we? enum WriterType { Screen, File } -#[cfg(stage0)] -impl WriterType: Eq { - pure fn eq(&&other: WriterType) -> bool { - match (self, other) { - (Screen, Screen) | (File, File) => true, - (Screen, _) | (File, _) => false - } - } - pure fn ne(&&other: WriterType) -> bool { !self.eq(other) } -} -#[cfg(stage1)] -#[cfg(stage2)] impl WriterType : Eq { pure fn eq(other: &WriterType) -> bool { match (self, (*other)) { diff --git a/src/libcore/ops.rs b/src/libcore/ops.rs index bf67fe04ea0..28f7d21f574 100644 --- a/src/libcore/ops.rs +++ b/src/libcore/ops.rs @@ -20,66 +20,26 @@ trait Owned { // Empty. } -#[cfg(stage0)] -#[lang="add"] -trait Add { - pure fn add(rhs: RHS) -> Result; -} - -#[cfg(stage1)] -#[cfg(stage2)] #[lang="add"] trait Add { pure fn add(rhs: &RHS) -> Result; } -#[cfg(stage0)] -#[lang="sub"] -trait Sub { - pure fn sub(rhs: RHS) -> Result; -} - -#[cfg(stage1)] -#[cfg(stage2)] #[lang="sub"] trait Sub { pure fn sub(rhs: &RHS) -> Result; } -#[cfg(stage0)] -#[lang="mul"] -trait Mul { - pure fn mul(rhs: RHS) -> Result; -} - -#[cfg(stage1)] -#[cfg(stage2)] #[lang="mul"] trait Mul { pure fn mul(rhs: &RHS) -> Result; } -#[cfg(stage0)] -#[lang="div"] -trait Div { - pure fn div(rhs: RHS) -> Result; -} - -#[cfg(stage1)] -#[cfg(stage2)] #[lang="div"] trait Div { pure fn div(rhs: &RHS) -> Result; } -#[cfg(stage0)] -#[lang="modulo"] -trait Modulo { - pure fn modulo(rhs: RHS) -> Result; -} - -#[cfg(stage1)] -#[cfg(stage2)] #[lang="modulo"] trait Modulo { pure fn modulo(rhs: &RHS) -> Result; @@ -90,66 +50,26 @@ trait Neg { pure fn neg() -> Result; } -#[cfg(stage0)] -#[lang="bitand"] -trait BitAnd { - pure fn bitand(rhs: RHS) -> Result; -} - -#[cfg(stage1)] -#[cfg(stage2)] #[lang="bitand"] trait BitAnd { pure fn bitand(rhs: &RHS) -> Result; } -#[cfg(stage0)] -#[lang="bitor"] -trait BitOr { - pure fn bitor(rhs: RHS) -> Result; -} - -#[cfg(stage1)] -#[cfg(stage2)] #[lang="bitor"] trait BitOr { pure fn bitor(rhs: &RHS) -> Result; } -#[cfg(stage0)] -#[lang="bitxor"] -trait BitXor { - pure fn bitxor(rhs: RHS) -> Result; -} - -#[cfg(stage1)] -#[cfg(stage2)] #[lang="bitxor"] trait BitXor { pure fn bitxor(rhs: &RHS) -> Result; } -#[cfg(stage0)] -#[lang="shl"] -trait Shl { - pure fn shl(rhs: RHS) -> Result; -} - -#[cfg(stage1)] -#[cfg(stage2)] #[lang="shl"] trait Shl { pure fn shl(rhs: &RHS) -> Result; } -#[cfg(stage0)] -#[lang="shr"] -trait Shr { - pure fn shr(rhs: RHS) -> Result; -} - -#[cfg(stage1)] -#[cfg(stage2)] #[lang="shr"] trait Shr { pure fn shr(rhs: &RHS) -> Result; diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 94e824d9ad9..6ab9a86d8f3 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -255,28 +255,6 @@ impl Option { pure fn while_some(blk: fn(+v: T) -> Option) { while_some(self, blk) } } -#[cfg(stage0)] -impl Option : Eq { - pure fn eq(&&other: Option) -> bool { - match self { - None => { - match other { - None => true, - Some(_) => false - } - } - Some(self_contents) => { - match other { - None => false, - Some(other_contents) => self_contents.eq(other_contents) - } - } - } - } - pure fn ne(&&other: Option) -> bool { !self.eq(other) } -} -#[cfg(stage1)] -#[cfg(stage2)] impl Option : Eq { pure fn eq(other: &Option) -> bool { match self { diff --git a/src/libcore/path.rs b/src/libcore/path.rs index 49909208d75..ab847702d68 100644 --- a/src/libcore/path.rs +++ b/src/libcore/path.rs @@ -70,16 +70,6 @@ impl PosixPath : ToStr { } } -#[cfg(stage0)] -impl PosixPath : Eq { - pure fn eq(&&other: PosixPath) -> bool { - return self.is_absolute == other.is_absolute && - self.components == other.components; - } - pure fn ne(&&other: PosixPath) -> bool { !self.eq(other) } -} -#[cfg(stage1)] -#[cfg(stage2)] impl PosixPath : Eq { pure fn eq(other: &PosixPath) -> bool { return self.is_absolute == (*other).is_absolute && @@ -88,18 +78,6 @@ impl PosixPath : Eq { pure fn ne(other: &PosixPath) -> bool { !self.eq(other) } } -#[cfg(stage0)] -impl WindowsPath : Eq { - pure fn eq(&&other: WindowsPath) -> bool { - return self.host == other.host && - self.device == other.device && - self.is_absolute == other.is_absolute && - self.components == other.components; - } - pure fn ne(&&other: WindowsPath) -> bool { !self.eq(other) } -} -#[cfg(stage1)] -#[cfg(stage2)] impl WindowsPath : Eq { pure fn eq(other: &WindowsPath) -> bool { return self.host == (*other).host && diff --git a/src/libcore/pipes.rs b/src/libcore/pipes.rs index ecc1e4e8a63..e213ce033d0 100644 --- a/src/libcore/pipes.rs +++ b/src/libcore/pipes.rs @@ -116,15 +116,6 @@ enum State { Terminated } -#[cfg(stage0)] -impl State: Eq { - pure fn eq(&&other: State) -> bool { - (self as uint) == (other as uint) - } - pure fn ne(&&other: State) -> bool { !self.eq(other) } -} -#[cfg(stage1)] -#[cfg(stage2)] impl State : Eq { pure fn eq(other: &State) -> bool { (self as uint) == ((*other) as uint) diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 47a9f60afa5..7a31f42d8c4 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -205,17 +205,6 @@ impl *T: Ptr { } // Equality for pointers -#[cfg(stage0)] -impl *const T : Eq { - pure fn eq(&&other: *const T) -> bool unsafe { - let a: uint = cast::reinterpret_cast(&self); - let b: uint = cast::reinterpret_cast(&other); - return a == b; - } - pure fn ne(&&other: *const T) -> bool { !self.eq(other) } -} -#[cfg(stage1)] -#[cfg(stage2)] impl *const T : Eq { pure fn eq(other: &*const T) -> bool unsafe { let a: uint = cast::reinterpret_cast(&self); @@ -226,31 +215,6 @@ impl *const T : Eq { } // Comparison for pointers -#[cfg(stage0)] -impl *const T : Ord { - pure fn lt(&&other: *const T) -> bool unsafe { - let a: uint = cast::reinterpret_cast(&self); - let b: uint = cast::reinterpret_cast(&other); - return a < b; - } - pure fn le(&&other: *const T) -> bool unsafe { - let a: uint = cast::reinterpret_cast(&self); - let b: uint = cast::reinterpret_cast(&other); - return a <= b; - } - pure fn ge(&&other: *const T) -> bool unsafe { - let a: uint = cast::reinterpret_cast(&self); - let b: uint = cast::reinterpret_cast(&other); - return a >= b; - } - pure fn gt(&&other: *const T) -> bool unsafe { - let a: uint = cast::reinterpret_cast(&self); - let b: uint = cast::reinterpret_cast(&other); - return a > b; - } -} -#[cfg(stage1)] -#[cfg(stage2)] impl *const T : Ord { pure fn lt(other: &*const T) -> bool unsafe { let a: uint = cast::reinterpret_cast(&self); @@ -275,28 +239,12 @@ impl *const T : Ord { } // Equality for region pointers -#[cfg(stage0)] -impl &const T : Eq { - pure fn eq(&&other: &const T) -> bool { return *self == *other; } - pure fn ne(&&other: &const T) -> bool { return *self != *other; } -} -#[cfg(stage1)] -#[cfg(stage2)] impl &const T : Eq { pure fn eq(other: & &const T) -> bool { return *self == *(*other); } pure fn ne(other: & &const T) -> bool { return *self != *(*other); } } // Comparison for region pointers -#[cfg(stage0)] -impl &const T : Ord { - pure fn lt(&&other: &const T) -> bool { *self < *other } - pure fn le(&&other: &const T) -> bool { *self <= *other } - pure fn ge(&&other: &const T) -> bool { *self >= *other } - pure fn gt(&&other: &const T) -> bool { *self > *other } -} -#[cfg(stage1)] -#[cfg(stage2)] impl &const T : Ord { pure fn lt(other: & &const T) -> bool { *self < *(*other) } pure fn le(other: & &const T) -> bool { *self <= *(*other) } diff --git a/src/libcore/repr.rs b/src/libcore/repr.rs index 38825c4cb0f..30b43dd7f84 100644 --- a/src/libcore/repr.rs +++ b/src/libcore/repr.rs @@ -510,15 +510,6 @@ enum EnumVisitState { Degenerate // This is a degenerate enum (exactly 1 variant) } -#[cfg(stage0)] -impl EnumVisitState : cmp::Eq { - pure fn eq(&&other: EnumVisitState) -> bool { - (self as uint) == (other as uint) - } - pure fn ne(&&other: EnumVisitState) -> bool { !self.eq(other) } -} -#[cfg(stage1)] -#[cfg(stage2)] impl EnumVisitState : cmp::Eq { pure fn eq(other: &EnumVisitState) -> bool { (self as uint) == ((*other) as uint) diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 720110c0e10..205d375e9db 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -354,28 +354,6 @@ fn unwrap_err(+res: Result) -> U { } } -#[cfg(stage0)] -impl Result : Eq { - pure fn eq(&&other: Result) -> bool { - match self { - Ok(e0a) => { - match other { - Ok(e0b) => e0a == e0b, - _ => false - } - } - Err(e0a) => { - match other { - Err(e0b) => e0a == e0b, - _ => false - } - } - } - } - pure fn ne(&&other: Result) -> bool { !self.eq(other) } -} -#[cfg(stage1)] -#[cfg(stage2)] impl Result : Eq { pure fn eq(other: &Result) -> bool { match self { diff --git a/src/libcore/str.rs b/src/libcore/str.rs index 7adc0babe20..737cd4d9d50 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -804,17 +804,6 @@ pure fn gt(a: &str, b: &str) -> bool { !le(a, b) } -#[cfg(stage0)] -impl &str: Eq { - #[inline(always)] - pure fn eq(&&other: &str) -> bool { - eq_slice(self, other) - } - #[inline(always)] - pure fn ne(&&other: &str) -> bool { !self.eq(other) } -} -#[cfg(stage1)] -#[cfg(stage2)] impl &str : Eq { #[inline(always)] pure fn eq(other: & &str) -> bool { @@ -824,17 +813,6 @@ impl &str : Eq { pure fn ne(other: & &str) -> bool { !self.eq(other) } } -#[cfg(stage0)] -impl ~str: Eq { - #[inline(always)] - pure fn eq(&&other: ~str) -> bool { - eq_slice(self, other) - } - #[inline(always)] - pure fn ne(&&other: ~str) -> bool { !self.eq(other) } -} -#[cfg(stage1)] -#[cfg(stage2)] impl ~str : Eq { #[inline(always)] pure fn eq(other: &~str) -> bool { @@ -844,17 +822,6 @@ impl ~str : Eq { pure fn ne(other: &~str) -> bool { !self.eq(other) } } -#[cfg(stage0)] -impl @str: Eq { - #[inline(always)] - pure fn eq(&&other: @str) -> bool { - eq_slice(self, other) - } - #[inline(always)] - pure fn ne(&&other: @str) -> bool { !self.eq(other) } -} -#[cfg(stage1)] -#[cfg(stage2)] impl @str : Eq { #[inline(always)] pure fn eq(other: &@str) -> bool { @@ -864,19 +831,6 @@ impl @str : Eq { pure fn ne(other: &@str) -> bool { !self.eq(other) } } -#[cfg(stage0)] -impl ~str : Ord { - #[inline(always)] - pure fn lt(&&other: ~str) -> bool { lt(self, other) } - #[inline(always)] - pure fn le(&&other: ~str) -> bool { le(self, other) } - #[inline(always)] - pure fn ge(&&other: ~str) -> bool { ge(self, other) } - #[inline(always)] - pure fn gt(&&other: ~str) -> bool { gt(self, other) } -} -#[cfg(stage1)] -#[cfg(stage2)] impl ~str : Ord { #[inline(always)] pure fn lt(other: &~str) -> bool { lt(self, (*other)) } @@ -888,19 +842,6 @@ impl ~str : Ord { pure fn gt(other: &~str) -> bool { gt(self, (*other)) } } -#[cfg(stage0)] -impl &str : Ord { - #[inline(always)] - pure fn lt(&&other: &str) -> bool { lt(self, other) } - #[inline(always)] - pure fn le(&&other: &str) -> bool { le(self, other) } - #[inline(always)] - pure fn ge(&&other: &str) -> bool { ge(self, other) } - #[inline(always)] - pure fn gt(&&other: &str) -> bool { gt(self, other) } -} -#[cfg(stage1)] -#[cfg(stage2)] impl &str : Ord { #[inline(always)] pure fn lt(other: & &str) -> bool { lt(self, (*other)) } @@ -912,19 +853,6 @@ impl &str : Ord { pure fn gt(other: & &str) -> bool { gt(self, (*other)) } } -#[cfg(stage0)] -impl @str : Ord { - #[inline(always)] - pure fn lt(&&other: @str) -> bool { lt(self, other) } - #[inline(always)] - pure fn le(&&other: @str) -> bool { le(self, other) } - #[inline(always)] - pure fn ge(&&other: @str) -> bool { ge(self, other) } - #[inline(always)] - pure fn gt(&&other: @str) -> bool { gt(self, other) } -} -#[cfg(stage1)] -#[cfg(stage2)] impl @str : Ord { #[inline(always)] pure fn lt(other: &@str) -> bool { lt(self, (*other)) } @@ -2244,15 +2172,6 @@ impl ~str: UniqueStr { #[cfg(notest)] mod traits { #[legacy_exports]; - #[cfg(stage0)] - impl ~str: Add<&str,~str> { - #[inline(always)] - pure fn add(rhs: &str) -> ~str { - append(copy self, rhs) - } - } - #[cfg(stage1)] - #[cfg(stage2)] impl ~str : Add<&str,~str> { #[inline(always)] pure fn add(rhs: & &str) -> ~str { diff --git a/src/libcore/task.rs b/src/libcore/task.rs index 1f38a10b2e7..9e2949c37ef 100644 --- a/src/libcore/task.rs +++ b/src/libcore/task.rs @@ -83,13 +83,6 @@ enum Task { TaskHandle(task_id) } -#[cfg(stage0)] -impl Task : cmp::Eq { - pure fn eq(&&other: Task) -> bool { *self == *other } - pure fn ne(&&other: Task) -> bool { !self.eq(other) } -} -#[cfg(stage1)] -#[cfg(stage2)] impl Task : cmp::Eq { pure fn eq(other: &Task) -> bool { *self == *(*other) } pure fn ne(other: &Task) -> bool { !self.eq(other) } @@ -111,18 +104,6 @@ enum TaskResult { Failure, } -#[cfg(stage0)] -impl TaskResult: Eq { - pure fn eq(&&other: TaskResult) -> bool { - match (self, other) { - (Success, Success) | (Failure, Failure) => true, - (Success, _) | (Failure, _) => false - } - } - pure fn ne(&&other: TaskResult) -> bool { !self.eq(other) } -} -#[cfg(stage1)] -#[cfg(stage2)] impl TaskResult : Eq { pure fn eq(other: &TaskResult) -> bool { match (self, (*other)) { @@ -139,21 +120,6 @@ enum Notification { Exit(Task, TaskResult) } -#[cfg(stage0)] -impl Notification : cmp::Eq { - pure fn eq(&&other: Notification) -> bool { - match self { - Exit(e0a, e1a) => { - match other { - Exit(e0b, e1b) => e0a == e0b && e1a == e1b - } - } - } - } - pure fn ne(&&other: Notification) -> bool { !self.eq(other) } -} -#[cfg(stage1)] -#[cfg(stage2)] impl Notification : cmp::Eq { pure fn eq(other: &Notification) -> bool { match self { @@ -186,48 +152,6 @@ enum SchedMode { PlatformThread } -#[cfg(stage0)] -impl SchedMode : cmp::Eq { - pure fn eq(&&other: SchedMode) -> bool { - match self { - SingleThreaded => { - match other { - SingleThreaded => true, - _ => false - } - } - ThreadPerCore => { - match other { - ThreadPerCore => true, - _ => false - } - } - ThreadPerTask => { - match other { - ThreadPerTask => true, - _ => false - } - } - ManualThreads(e0a) => { - match other { - ManualThreads(e0b) => e0a == e0b, - _ => false - } - } - PlatformThread => { - match other { - PlatformThread => true, - _ => false - } - } - } - } - pure fn ne(&&other: SchedMode) -> bool { - !self.eq(other) - } -} -#[cfg(stage1)] -#[cfg(stage2)] impl SchedMode : cmp::Eq { pure fn eq(other: &SchedMode) -> bool { match self { diff --git a/src/libcore/task/local_data_priv.rs b/src/libcore/task/local_data_priv.rs index b4a9301ca0b..2fbb88327ed 100644 --- a/src/libcore/task/local_data_priv.rs +++ b/src/libcore/task/local_data_priv.rs @@ -6,17 +6,6 @@ use rt::rust_task; trait LocalData { } impl @T: LocalData { } -#[cfg(stage0)] -impl LocalData: Eq { - pure fn eq(&&other: LocalData) -> bool unsafe { - let ptr_a: (uint, uint) = cast::reinterpret_cast(&self); - let ptr_b: (uint, uint) = cast::reinterpret_cast(&other); - return ptr_a == ptr_b; - } - pure fn ne(&&other: LocalData) -> bool { !self.eq(other) } -} -#[cfg(stage1)] -#[cfg(stage2)] impl LocalData: Eq { pure fn eq(other: &@LocalData) -> bool unsafe { let ptr_a: (uint, uint) = cast::reinterpret_cast(&self); diff --git a/src/libcore/tuple.rs b/src/libcore/tuple.rs index 0159a0fd615..8ec6ed3f0c2 100644 --- a/src/libcore/tuple.rs +++ b/src/libcore/tuple.rs @@ -67,25 +67,6 @@ impl (~[A], ~[B]): ExtendedTupleOps { } } -#[cfg(stage0)] -impl (A, B): Eq { - pure fn eq(&&other: (A, B)) -> bool { - // XXX: This would be a lot less wordy with ref bindings, but I don't - // trust that they work yet. - match self { - (self_a, self_b) => { - match other { - (other_a, other_b) => { - self_a.eq(other_a) && self_b.eq(other_b) - } - } - } - } - } - pure fn ne(&&other: (A, B)) -> bool { !self.eq(other) } -} -#[cfg(stage1)] -#[cfg(stage2)] impl (A, B) : Eq { pure fn eq(other: &(A, B)) -> bool { // XXX: This would be a lot less wordy with ref bindings, but I don't @@ -103,28 +84,6 @@ impl (A, B) : Eq { pure fn ne(other: &(A, B)) -> bool { !self.eq(other) } } -#[cfg(stage0)] -impl (A, B): Ord { - pure fn lt(&&other: (A, B)) -> bool { - match self { - (self_a, self_b) => { - match other { - (other_a, other_b) => { - if self_a.lt(other_a) { return true; } - if other_a.lt(self_a) { return false; } - if self_b.lt(other_b) { return true; } - return false; - } - } - } - } - } - pure fn le(&&other: (A, B)) -> bool { !other.lt(self) } - pure fn ge(&&other: (A, B)) -> bool { !self.lt(other) } - pure fn gt(&&other: (A, B)) -> bool { other.lt(self) } -} -#[cfg(stage1)] -#[cfg(stage2)] impl (A, B) : Ord { pure fn lt(other: &(A, B)) -> bool { match self { @@ -145,27 +104,6 @@ impl (A, B) : Ord { pure fn gt(other: &(A, B)) -> bool { (*other).lt(&self) } } -#[cfg(stage0)] -impl (A, B, C): Eq { - pure fn eq(&&other: (A, B, C)) -> bool { - // XXX: This would be a lot less wordy with ref bindings, but I don't - // trust that they work yet. - match self { - (self_a, self_b, self_c) => { - match other { - (other_a, other_b, other_c) => { - self_a.eq(other_a) && - self_b.eq(other_b) && - self_c.eq(other_c) - } - } - } - } - } - pure fn ne(&&other: (A, B, C)) -> bool { !self.eq(other) } -} -#[cfg(stage1)] -#[cfg(stage2)] impl (A, B, C) : Eq { pure fn eq(other: &(A, B, C)) -> bool { // XXX: This would be a lot less wordy with ref bindings, but I don't @@ -185,30 +123,6 @@ impl (A, B, C) : Eq { pure fn ne(other: &(A, B, C)) -> bool { !self.eq(other) } } -#[cfg(stage0)] -impl (A, B, C): Ord { - pure fn lt(&&other: (A, B, C)) -> bool { - match self { - (self_a, self_b, self_c) => { - match other { - (other_a, other_b, other_c) => { - if self_a.lt(other_a) { return true; } - if other_a.lt(self_a) { return false; } - if self_b.lt(other_b) { return true; } - if other_b.lt(self_b) { return false; } - if self_c.lt(other_c) { return true; } - return false; - } - } - } - } - } - pure fn le(&&other: (A, B, C)) -> bool { !other.lt(self) } - pure fn ge(&&other: (A, B, C)) -> bool { !self.lt(other) } - pure fn gt(&&other: (A, B, C)) -> bool { other.lt(self) } -} -#[cfg(stage1)] -#[cfg(stage2)] impl (A, B, C) : Ord { pure fn lt(other: &(A, B, C)) -> bool { match self { diff --git a/src/libcore/uint-template.rs b/src/libcore/uint-template.rs index a0fd5f58a19..8b3a60f4fe3 100644 --- a/src/libcore/uint-template.rs +++ b/src/libcore/uint-template.rs @@ -61,15 +61,6 @@ pure fn compl(i: T) -> T { max_value ^ i } -#[cfg(stage0)] -impl T: Ord { - pure fn lt(&&other: T) -> bool { self < other } - pure fn le(&&other: T) -> bool { self <= other } - pure fn ge(&&other: T) -> bool { self >= other } - pure fn gt(&&other: T) -> bool { self > other } -} -#[cfg(stage1)] -#[cfg(stage2)] impl T : Ord { pure fn lt(other: &T) -> bool { self < (*other) } pure fn le(other: &T) -> bool { self <= (*other) } @@ -77,13 +68,6 @@ impl T : Ord { pure fn gt(other: &T) -> bool { self > (*other) } } -#[cfg(stage0)] -impl T: Eq { - pure fn eq(&&other: T) -> bool { return self == other; } - pure fn ne(&&other: T) -> bool { return self != other; } -} -#[cfg(stage1)] -#[cfg(stage2)] impl T : Eq { pure fn eq(other: &T) -> bool { return self == (*other); } pure fn ne(other: &T) -> bool { return self != (*other); } diff --git a/src/libcore/uniq.rs b/src/libcore/uniq.rs index f1842686ae1..1a752ce0e6c 100644 --- a/src/libcore/uniq.rs +++ b/src/libcore/uniq.rs @@ -2,27 +2,11 @@ use cmp::{Eq, Ord}; -#[cfg(stage0)] -impl ~const T : Eq { - pure fn eq(&&other: ~const T) -> bool { *self == *other } - pure fn ne(&&other: ~const T) -> bool { *self != *other } -} -#[cfg(stage1)] -#[cfg(stage2)] impl ~const T : Eq { pure fn eq(other: &~const T) -> bool { *self == *(*other) } pure fn ne(other: &~const T) -> bool { *self != *(*other) } } -#[cfg(stage0)] -impl ~const T : Ord { - pure fn lt(&&other: ~const T) -> bool { *self < *other } - pure fn le(&&other: ~const T) -> bool { *self <= *other } - pure fn ge(&&other: ~const T) -> bool { *self >= *other } - pure fn gt(&&other: ~const T) -> bool { *self > *other } -} -#[cfg(stage1)] -#[cfg(stage2)] impl ~const T : Ord { pure fn lt(other: &~const T) -> bool { *self < *(*other) } pure fn le(other: &~const T) -> bool { *self <= *(*other) } diff --git a/src/libcore/unit.rs b/src/libcore/unit.rs index 30f1f5ab99c..4ccdf12b500 100644 --- a/src/libcore/unit.rs +++ b/src/libcore/unit.rs @@ -6,27 +6,11 @@ Functions for the unit type. use cmp::{Eq, Ord}; -#[cfg(stage0)] -impl () : Eq { - pure fn eq(&&_other: ()) -> bool { true } - pure fn ne(&&_other: ()) -> bool { false } -} -#[cfg(stage1)] -#[cfg(stage2)] impl () : Eq { pure fn eq(_other: &()) -> bool { true } pure fn ne(_other: &()) -> bool { false } } -#[cfg(stage0)] -impl () : Ord { - pure fn lt(&&_other: ()) -> bool { false } - pure fn le(&&_other: ()) -> bool { true } - pure fn ge(&&_other: ()) -> bool { true } - pure fn gt(&&_other: ()) -> bool { false } -} -#[cfg(stage1)] -#[cfg(stage2)] impl () : Ord { pure fn lt(_other: &()) -> bool { false } pure fn le(_other: &()) -> bool { true } diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs index 7edd47f52d9..d458ac411e3 100644 --- a/src/libcore/vec.rs +++ b/src/libcore/vec.rs @@ -1370,15 +1370,6 @@ pure fn eq(a: &[T], b: &[T]) -> bool { return true; } -#[cfg(stage0)] -impl &[T]: Eq { - #[inline(always)] - pure fn eq(&&other: &[T]) -> bool { eq(self, other) } - #[inline(always)] - pure fn ne(&&other: &[T]) -> bool { !self.eq(other) } -} -#[cfg(stage1)] -#[cfg(stage2)] impl &[T] : Eq { #[inline(always)] pure fn eq(other: & &[T]) -> bool { eq(self, (*other)) } @@ -1386,15 +1377,6 @@ impl &[T] : Eq { pure fn ne(other: & &[T]) -> bool { !self.eq(other) } } -#[cfg(stage0)] -impl ~[T]: Eq { - #[inline(always)] - pure fn eq(&&other: ~[T]) -> bool { eq(self, other) } - #[inline(always)] - pure fn ne(&&other: ~[T]) -> bool { !self.eq(other) } -} -#[cfg(stage1)] -#[cfg(stage2)] impl ~[T] : Eq { #[inline(always)] pure fn eq(other: &~[T]) -> bool { eq(self, (*other)) } @@ -1402,15 +1384,6 @@ impl ~[T] : Eq { pure fn ne(other: &~[T]) -> bool { !self.eq(other) } } -#[cfg(stage0)] -impl @[T]: Eq { - #[inline(always)] - pure fn eq(&&other: @[T]) -> bool { eq(self, other) } - #[inline(always)] - pure fn ne(&&other: @[T]) -> bool { !self.eq(other) } -} -#[cfg(stage1)] -#[cfg(stage2)] impl @[T] : Eq { #[inline(always)] pure fn eq(other: &@[T]) -> bool { eq(self, (*other)) } @@ -1439,19 +1412,6 @@ pure fn le(a: &[T], b: &[T]) -> bool { !lt(b, a) } pure fn ge(a: &[T], b: &[T]) -> bool { !lt(a, b) } pure fn gt(a: &[T], b: &[T]) -> bool { lt(b, a) } -#[cfg(stage0)] -impl &[T]: Ord { - #[inline(always)] - pure fn lt(&&other: &[T]) -> bool { lt(self, other) } - #[inline(always)] - pure fn le(&&other: &[T]) -> bool { le(self, other) } - #[inline(always)] - pure fn ge(&&other: &[T]) -> bool { ge(self, other) } - #[inline(always)] - pure fn gt(&&other: &[T]) -> bool { gt(self, other) } -} -#[cfg(stage1)] -#[cfg(stage2)] impl &[T] : Ord { #[inline(always)] pure fn lt(other: & &[T]) -> bool { lt(self, (*other)) } @@ -1463,19 +1423,6 @@ impl &[T] : Ord { pure fn gt(other: & &[T]) -> bool { gt(self, (*other)) } } -#[cfg(stage0)] -impl ~[T]: Ord { - #[inline(always)] - pure fn lt(&&other: ~[T]) -> bool { lt(self, other) } - #[inline(always)] - pure fn le(&&other: ~[T]) -> bool { le(self, other) } - #[inline(always)] - pure fn ge(&&other: ~[T]) -> bool { ge(self, other) } - #[inline(always)] - pure fn gt(&&other: ~[T]) -> bool { gt(self, other) } -} -#[cfg(stage1)] -#[cfg(stage2)] impl ~[T] : Ord { #[inline(always)] pure fn lt(other: &~[T]) -> bool { lt(self, (*other)) } @@ -1487,19 +1434,6 @@ impl ~[T] : Ord { pure fn gt(other: &~[T]) -> bool { gt(self, (*other)) } } -#[cfg(stage0)] -impl @[T]: Ord { - #[inline(always)] - pure fn lt(&&other: @[T]) -> bool { lt(self, other) } - #[inline(always)] - pure fn le(&&other: @[T]) -> bool { le(self, other) } - #[inline(always)] - pure fn ge(&&other: @[T]) -> bool { ge(self, other) } - #[inline(always)] - pure fn gt(&&other: @[T]) -> bool { gt(self, other) } -} -#[cfg(stage1)] -#[cfg(stage2)] impl @[T] : Ord { #[inline(always)] pure fn lt(other: &@[T]) -> bool { lt(self, (*other)) } @@ -1514,16 +1448,6 @@ impl @[T] : Ord { #[cfg(notest)] mod traits { #[legacy_exports]; - #[cfg(stage0)] - impl ~[T]: Add<&[const T],~[T]> { - #[inline(always)] - pure fn add(rhs: &[const T]) -> ~[T] { - append(copy self, rhs) - } - } - - #[cfg(stage1)] - #[cfg(stage2)] impl ~[T] : Add<&[const T],~[T]> { #[inline(always)] pure fn add(rhs: & &[const T]) -> ~[T] { @@ -1531,16 +1455,6 @@ mod traits { } } - #[cfg(stage0)] - impl ~[mut T]: Add<&[const T],~[mut T]> { - #[inline(always)] - pure fn add(rhs: &[const T]) -> ~[mut T] { - append_mut(copy self, rhs) - } - } - - #[cfg(stage1)] - #[cfg(stage2)] impl ~[mut T] : Add<&[const T],~[mut T]> { #[inline(always)] pure fn add(rhs: & &[const T]) -> ~[mut T] { -- cgit 1.4.1-3-g733a5