diff --git a/src/compiletest/common.rs b/src/compiletest/common.rs index b951c9fc3c1..dcbe419ddb1 100644 --- a/src/compiletest/common.rs +++ b/src/compiletest/common.rs @@ -1,14 +1,5 @@ enum mode { mode_compile_fail, mode_run_fail, mode_run_pass, mode_pretty, } -#[cfg(stage0)] -impl mode : cmp::Eq { - pure fn eq(other: &mode) -> bool { - (*other) as int == self as int - } - pure fn ne(other: &mode) -> bool { !self.eq(other) } -} -#[cfg(stage1)] -#[cfg(stage2)] impl mode : cmp::Eq { pure fn eq(&self, other: &mode) -> bool { (*other) as int == (*self) as int diff --git a/src/libcargo/cargo.rc b/src/libcargo/cargo.rc index 1d94318bef4..36b76bcbfe2 100644 --- a/src/libcargo/cargo.rc +++ b/src/libcargo/cargo.rc @@ -65,25 +65,6 @@ struct Package { } impl Package : cmp::Ord { - #[cfg(stage0)] - pure fn lt(other: &Package) -> bool { - if self.name.lt(&(*other).name) { return true; } - if (*other).name.lt(&self.name) { return false; } - if self.uuid.lt(&(*other).uuid) { return true; } - if (*other).uuid.lt(&self.uuid) { return false; } - if self.url.lt(&(*other).url) { return true; } - if (*other).url.lt(&self.url) { return false; } - if self.method.lt(&(*other).method) { return true; } - if (*other).method.lt(&self.method) { return false; } - if self.description.lt(&(*other).description) { return true; } - if (*other).description.lt(&self.description) { return false; } - if self.tags.lt(&(*other).tags) { return true; } - if (*other).tags.lt(&self.tags) { return false; } - if self.versions.lt(&(*other).versions) { return true; } - return false; - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn lt(&self, other: &Package) -> bool { if (*self).name.lt(&(*other).name) { return true; } if (*other).name.lt(&(*self).name) { return false; } @@ -100,20 +81,8 @@ impl Package : cmp::Ord { if (*self).versions.lt(&(*other).versions) { return true; } return false; } - #[cfg(stage0)] - pure fn le(other: &Package) -> bool { !(*other).lt(&self) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn le(&self, other: &Package) -> bool { !(*other).lt(&(*self)) } - #[cfg(stage0)] - pure fn ge(other: &Package) -> bool { !self.lt(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ge(&self, other: &Package) -> bool { !(*self).lt(other) } - #[cfg(stage0)] - pure fn gt(other: &Package) -> bool { (*other).lt(&self) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn gt(&self, other: &Package) -> bool { (*other).lt(&(*self)) } } @@ -160,19 +129,9 @@ struct Options { enum Mode { SystemMode, UserMode, LocalMode } impl Mode : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &Mode) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &Mode) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &Mode) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &Mode) -> bool { !(*self).eq(other) } } diff --git a/src/libcore/alternate_crate.rc b/src/libcore/alternate_crate.rc deleted file mode 100644 index 74f8d6b5cec..00000000000 --- a/src/libcore/alternate_crate.rc +++ /dev/null @@ -1,273 +0,0 @@ -/*! - -The Rust core library. - -The Rust core library provides runtime features required by the language, -including the task scheduler and memory allocators, as well as library -support for Rust built-in types, platform abstractions, and other commonly -used features. - -`core` includes modules corresponding to each of the integer types, each of -the floating point types, the `bool` type, tuples, characters, strings, -vectors (`vec`), shared boxes (`box`), and unsafe and borrowed pointers -(`ptr`). Additionally, `core` provides task management and creation (`task`), -communication primitives (`comm` and `pipes`), an efficient vector builder -(`dvec`), platform abstractions (`os` and `path`), basic I/O abstractions -(`io`), common traits (`cmp`, `num`, `to_str`), and complete bindings -to the C standard library (`libc`). - -`core` is linked to all crates by default and its contents imported. -Implicitly, all crates behave as if they included the following prologue: - - extern mod core; - use core::*; - -*/ - -#[link(name = "core", - vers = "0.5", - uuid = "c70c24a7-5551-4f73-8e37-380b11d80be8", - url = "https://github.com/mozilla/rust/tree/master/src/libcore")]; - -#[comment = "The Rust core library"]; -#[license = "MIT"]; -#[crate_type = "lib"]; - -// Don't link to core. We are core. -#[no_core]; - -#[warn(deprecated_mode)]; -#[warn(deprecated_pattern)]; - -#[warn(vecs_implicitly_copyable)]; -#[deny(non_camel_case_types)]; - -// Built-in-type support modules - -/// Operations and constants for `int` -#[path = "int-template.rs"] -#[merge = "int-template/intb.rs"] -pub mod int; - -/// Operations and constants for `i8` -#[path = "int-template.rs"] -#[merge = "int-template/i8b.rs"] -pub mod i8; - -/// Operations and constants for `i16` -#[path = "int-template.rs"] -#[merge = "int-template/i16b.rs"] -pub mod i16; - -/// Operations and constants for `i32` -#[path = "int-template.rs"] -#[merge = "int-template/i32b.rs"] -pub mod i32; - -/// Operations and constants for `i64` -#[path = "int-template.rs"] -#[merge = "int-template/i64b.rs"] -pub mod i64; - -/// Operations and constants for `uint` -#[path = "uint-template.rs"] -#[merge = "uint-template/uintb.rs"] -pub mod uint; - -/// Operations and constants for `u8` -#[path = "uint-template.rs"] -#[merge = "uint-template/u8b.rs"] -pub mod u8; - -/// Operations and constants for `u16` -#[path = "uint-template.rs"] -#[merge = "uint-template/u16b.rs"] -pub mod u16; - -/// Operations and constants for `u32` -#[path = "uint-template.rs"] -#[merge = "uint-template/u32b.rs"] -pub mod u32; - -/// Operations and constants for `u64` -#[path = "uint-template.rs"] -#[merge = "uint-template/u64b.rs"] -pub mod u64; - - -pub mod box; -pub mod char; -pub mod float; -pub mod f32; -pub mod f64; -pub mod str; -pub mod ptr; -pub mod vec; -pub mod at_vec; -pub mod bool; -pub mod tuple; -pub mod unit; -pub mod owned; - -// Ubiquitous-utility-type modules - -#[cfg(notest)] -pub mod ops; -pub mod cmp; -pub mod num; -pub mod hash; -pub mod either; -pub mod iter; -pub mod logging; -pub mod option; -#[path="iter-trait.rs"] -#[merge = "iter-trait/optionb.rs"] -pub mod option_iter; -pub mod result; -pub mod to_str; -pub mod to_bytes; -pub mod from_str; -pub mod util; - -// Data structure modules - -pub mod dvec; -#[path="iter-trait.rs"] -#[merge = "iter-trait/dvecb.rs"] -pub mod dvec_iter; -pub mod dlist; -#[path="iter-trait.rs"] -#[merge = "iter-trait/dlistb.rs"] -pub mod dlist_iter; -pub mod send_map; - -// Concurrency -pub mod comm; -#[merge = "task/mod.rs"] -pub mod task; -pub mod pipes; - -// Runtime and language-primitive support - -pub mod gc; -pub mod io; -pub mod libc; -pub mod os; -pub mod path; -pub mod rand; -pub mod run; -pub mod sys; -pub mod cast; -pub mod mutable; -pub mod flate; -pub mod repr; -pub mod cleanup; -pub mod reflect; -pub mod condition; - -// Modules supporting compiler-generated code -// Exported but not part of the public interface - -pub mod extfmt; -// The test harness links against core, so don't include runtime in tests. -#[cfg(notest)] -#[legacy_exports] -pub mod rt; - -// Ideally not exported, but currently is. -pub mod private; - -// For internal use, not exported. -mod unicode; -mod cmath; -mod stackwalk; - -// Top-level, visible-everywhere definitions. - -// Export various ubiquitous types, constructors, methods. - -pub use option::{Some, None}; -pub use Option = option::Option; -pub use result::{Result, Ok, Err}; - -pub use Path = path::Path; -pub use GenericPath = path::GenericPath; -pub use WindowsPath = path::WindowsPath; -pub use PosixPath = path::PosixPath; - -pub use tuple::{CopyableTuple, ImmutableTuple, ExtendedTupleOps}; -pub use str::{StrSlice, Trimmable}; -pub use vec::{ConstVector, CopyableVector, ImmutableVector}; -pub use vec::{ImmutableEqVector, ImmutableCopyableVector}; -pub use vec::{MutableVector, MutableCopyableVector}; -pub use iter::{BaseIter, ExtendedIter, EqIter, CopyableIter}; -pub use iter::{CopyableOrderedIter, CopyableNonstrictIter, Times}; -pub use num::Num; -pub use ptr::Ptr; -pub use to_str::ToStr; - -// The following exports are the core operators and kinds -// The compiler has special knowlege of these so we must not duplicate them -// when compiling for testing -#[cfg(notest)] -pub use ops::{Const, Copy, Send, Owned}; -#[cfg(notest)] -pub use ops::{Drop}; -#[cfg(notest)] -pub use ops::{Add, Sub, Mul, Div, Modulo, Neg, BitAnd, BitOr, BitXor}; -#[cfg(notest)] -pub use ops::{Shl, Shr, Index}; - -#[cfg(test)] -extern mod coreops(name = "core", vers = "0.5"); - -#[cfg(test)] -pub use coreops::ops::{Const, Copy, Send, Owned}; -#[cfg(test)] -pub use coreops::ops::{Drop}; -#[cfg(test)] -pub use coreops::ops::{Add, Sub, Mul, Div, Modulo, Neg, BitAnd, BitOr}; -#[cfg(test)] -pub use coreops::ops::{BitXor}; -#[cfg(test)] -pub use coreops::ops::{Shl, Shr, Index}; - - -// Export the log levels as global constants. Higher levels mean -// more-verbosity. Error is the bottom level, default logging level is -// warn-and-below. - -/// The error log level -pub const error : u32 = 1_u32; -/// The warning log level -pub const warn : u32 = 2_u32; -/// The info log level -pub const info : u32 = 3_u32; -/// The debug log level -pub const debug : u32 = 4_u32; - -// A curious inner-module that's not exported that contains the binding -// 'core' so that macro-expanded references to core::error and such -// can be resolved within libcore. -#[doc(hidden)] // FIXME #3538 -mod core { - pub const error : u32 = 1_u32; - pub const warn : u32 = 2_u32; - pub const info : u32 = 3_u32; - pub const debug : u32 = 4_u32; -} - -// Similar to above. Some magic to make core testable. -#[cfg(test)] -mod std { - extern mod std(vers = "0.5"); - pub use std::test; -} - -// Local Variables: -// mode: rust; -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/libcore/bool.rs b/src/libcore/bool.rs index 60aa3d48fb3..644cc90ccf6 100644 --- a/src/libcore/bool.rs +++ b/src/libcore/bool.rs @@ -66,15 +66,7 @@ pub fn all_values(blk: fn(v: bool)) { pub pure fn to_bit(v: bool) -> u8 { if v { 1u8 } else { 0u8 } } impl bool : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &bool) -> bool { self == (*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &bool) -> bool { (*self) == (*other) } - #[cfg(stage0)] - pure fn ne(other: &bool) -> bool { self != (*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &bool) -> bool { (*self) != (*other) } } diff --git a/src/libcore/box.rs b/src/libcore/box.rs index 4c32e58f56e..4b4890f770f 100644 --- a/src/libcore/box.rs +++ b/src/libcore/box.rs @@ -28,38 +28,14 @@ pub pure fn ptr_eq(a: @T, b: @T) -> bool { } impl @const T : Eq { - #[cfg(stage0)] - pure fn eq(other: &@const T) -> bool { *self == *(*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &@const T) -> bool { *(*self) == *(*other) } - #[cfg(stage0)] - pure fn ne(other: &@const T) -> bool { *self != *(*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &@const T) -> bool { *(*self) != *(*other) } } impl @const T : Ord { - #[cfg(stage0)] - pure fn lt(other: &@const T) -> bool { *self < *(*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn lt(&self, other: &@const T) -> bool { *(*self) < *(*other) } - #[cfg(stage0)] - pure fn le(other: &@const T) -> bool { *self <= *(*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn le(&self, other: &@const T) -> bool { *(*self) <= *(*other) } - #[cfg(stage0)] - pure fn ge(other: &@const T) -> bool { *self >= *(*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ge(&self, other: &@const T) -> bool { *(*self) >= *(*other) } - #[cfg(stage0)] - pure fn gt(other: &@const T) -> bool { *self > *(*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn gt(&self, other: &@const T) -> bool { *(*self) > *(*other) } } diff --git a/src/libcore/char.rs b/src/libcore/char.rs index 0a775ca1ac3..f1c67785aa0 100644 --- a/src/libcore/char.rs +++ b/src/libcore/char.rs @@ -181,15 +181,7 @@ pub pure fn cmp(a: char, b: char) -> int { } impl char : Eq { - #[cfg(stage0)] - pure fn eq(other: &char) -> bool { self == (*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &char) -> bool { (*self) == (*other) } - #[cfg(stage0)] - pure fn ne(other: &char) -> bool { self != (*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &char) -> bool { (*self) != (*other) } } diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs index c71111fb9e3..97f439d936b 100644 --- a/src/libcore/cmp.rs +++ b/src/libcore/cmp.rs @@ -30,17 +30,6 @@ mod nounittest { * default implementations. */ #[lang="ord"] - #[cfg(stage0)] - pub 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; - } - - #[lang="ord"] - #[cfg(stage1)] - #[cfg(stage2)] pub trait Ord { pure fn lt(&self, other: &self) -> bool; pure fn le(&self, other: &self) -> bool; @@ -58,15 +47,6 @@ mod nounittest { * a default implementation. */ #[lang="eq"] - #[cfg(stage0)] - pub trait Eq { - pure fn eq(other: &self) -> bool; - pure fn ne(other: &self) -> bool; - } - - #[lang="eq"] - #[cfg(stage1)] - #[cfg(stage2)] pub trait Eq { pure fn eq(&self, other: &self) -> bool; pure fn ne(&self, other: &self) -> bool; @@ -81,16 +61,6 @@ mod nounittest { mod unittest { #[legacy_exports]; - #[cfg(stage0)] - pub 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)] pub trait Ord { pure fn lt(&self, other: &self) -> bool; pure fn le(&self, other: &self) -> bool; @@ -98,14 +68,6 @@ mod unittest { pure fn gt(&self, other: &self) -> bool; } - #[cfg(stage0)] - pub trait Eq { - pure fn eq(other: &self) -> bool; - pure fn ne(other: &self) -> bool; - } - - #[cfg(stage1)] - #[cfg(stage2)] pub trait Eq { pure fn eq(&self, other: &self) -> bool; pure fn ne(&self, other: &self) -> bool; diff --git a/src/libcore/core.rc b/src/libcore/core.rc index 86417c93616..74f8d6b5cec 100644 --- a/src/libcore/core.rc +++ b/src/libcore/core.rc @@ -1,5 +1,3 @@ -// DIVERT - /*! The Rust core library. @@ -47,80 +45,54 @@ Implicitly, all crates behave as if they included the following prologue: // Built-in-type support modules /// Operations and constants for `int` -#[path = "int-template"] -pub mod int { - pub use inst::{ pow }; - #[path = "int.rs"] - pub mod inst; -} +#[path = "int-template.rs"] +#[merge = "int-template/intb.rs"] +pub mod int; /// Operations and constants for `i8` -#[path = "int-template"] -pub mod i8 { - #[path = "i8.rs"] - pub mod inst; -} +#[path = "int-template.rs"] +#[merge = "int-template/i8b.rs"] +pub mod i8; /// Operations and constants for `i16` -#[path = "int-template"] -pub mod i16 { - #[path = "i16.rs"] - pub mod inst; -} +#[path = "int-template.rs"] +#[merge = "int-template/i16b.rs"] +pub mod i16; /// Operations and constants for `i32` -#[path = "int-template"] -pub mod i32 { - #[path = "i32.rs"] - pub mod inst; -} +#[path = "int-template.rs"] +#[merge = "int-template/i32b.rs"] +pub mod i32; /// Operations and constants for `i64` -#[path = "int-template"] -pub mod i64 { - #[path = "i64.rs"] - pub mod inst; -} +#[path = "int-template.rs"] +#[merge = "int-template/i64b.rs"] +pub mod i64; /// Operations and constants for `uint` -#[path = "uint-template"] -pub mod uint { - pub use inst::{ - div_ceil, div_round, div_floor, iterate, - next_power_of_two - }; - #[path = "uint.rs"] - pub mod inst; -} +#[path = "uint-template.rs"] +#[merge = "uint-template/uintb.rs"] +pub mod uint; /// Operations and constants for `u8` -#[path = "uint-template"] -pub mod u8 { - pub use inst::is_ascii; - #[path = "u8.rs"] - pub mod inst; -} +#[path = "uint-template.rs"] +#[merge = "uint-template/u8b.rs"] +pub mod u8; /// Operations and constants for `u16` -#[path = "uint-template"] -pub mod u16 { - #[path = "u16.rs"] - pub mod inst; -} +#[path = "uint-template.rs"] +#[merge = "uint-template/u16b.rs"] +pub mod u16; /// Operations and constants for `u32` -#[path = "uint-template"] -pub mod u32 { - #[path = "u32.rs"] - pub mod inst; -} +#[path = "uint-template.rs"] +#[merge = "uint-template/u32b.rs"] +pub mod u32; /// Operations and constants for `u64` -#[path = "uint-template"] -pub mod u64 { - #[path = "u64.rs"] - pub mod inst; -} +#[path = "uint-template.rs"] +#[merge = "uint-template/u64b.rs"] +pub mod u64; pub mod box; @@ -148,11 +120,9 @@ pub mod either; pub mod iter; pub mod logging; pub mod option; -#[path="iter-trait"] -pub mod option_iter { - #[path = "option.rs"] - pub mod inst; -} +#[path="iter-trait.rs"] +#[merge = "iter-trait/optionb.rs"] +pub mod option_iter; pub mod result; pub mod to_str; pub mod to_bytes; @@ -162,27 +132,19 @@ pub mod util; // Data structure modules pub mod dvec; -#[path="iter-trait"] -pub mod dvec_iter { - #[path = "dvec.rs"] - pub mod inst; -} +#[path="iter-trait.rs"] +#[merge = "iter-trait/dvecb.rs"] +pub mod dvec_iter; pub mod dlist; -#[path="iter-trait"] -pub mod dlist_iter { - #[path ="dlist.rs"] - pub mod inst; -} +#[path="iter-trait.rs"] +#[merge = "iter-trait/dlistb.rs"] +pub mod dlist_iter; pub mod send_map; // Concurrency pub mod comm; -pub mod task { - pub mod local_data; - mod local_data_priv; - pub mod spawn; - pub mod rt; -} +#[merge = "task/mod.rs"] +pub mod task; pub mod pipes; // Runtime and language-primitive support @@ -220,6 +182,88 @@ mod unicode; mod cmath; mod stackwalk; +// Top-level, visible-everywhere definitions. + +// Export various ubiquitous types, constructors, methods. + +pub use option::{Some, None}; +pub use Option = option::Option; +pub use result::{Result, Ok, Err}; + +pub use Path = path::Path; +pub use GenericPath = path::GenericPath; +pub use WindowsPath = path::WindowsPath; +pub use PosixPath = path::PosixPath; + +pub use tuple::{CopyableTuple, ImmutableTuple, ExtendedTupleOps}; +pub use str::{StrSlice, Trimmable}; +pub use vec::{ConstVector, CopyableVector, ImmutableVector}; +pub use vec::{ImmutableEqVector, ImmutableCopyableVector}; +pub use vec::{MutableVector, MutableCopyableVector}; +pub use iter::{BaseIter, ExtendedIter, EqIter, CopyableIter}; +pub use iter::{CopyableOrderedIter, CopyableNonstrictIter, Times}; +pub use num::Num; +pub use ptr::Ptr; +pub use to_str::ToStr; + +// The following exports are the core operators and kinds +// The compiler has special knowlege of these so we must not duplicate them +// when compiling for testing +#[cfg(notest)] +pub use ops::{Const, Copy, Send, Owned}; +#[cfg(notest)] +pub use ops::{Drop}; +#[cfg(notest)] +pub use ops::{Add, Sub, Mul, Div, Modulo, Neg, BitAnd, BitOr, BitXor}; +#[cfg(notest)] +pub use ops::{Shl, Shr, Index}; + +#[cfg(test)] +extern mod coreops(name = "core", vers = "0.5"); + +#[cfg(test)] +pub use coreops::ops::{Const, Copy, Send, Owned}; +#[cfg(test)] +pub use coreops::ops::{Drop}; +#[cfg(test)] +pub use coreops::ops::{Add, Sub, Mul, Div, Modulo, Neg, BitAnd, BitOr}; +#[cfg(test)] +pub use coreops::ops::{BitXor}; +#[cfg(test)] +pub use coreops::ops::{Shl, Shr, Index}; + + +// Export the log levels as global constants. Higher levels mean +// more-verbosity. Error is the bottom level, default logging level is +// warn-and-below. + +/// The error log level +pub const error : u32 = 1_u32; +/// The warning log level +pub const warn : u32 = 2_u32; +/// The info log level +pub const info : u32 = 3_u32; +/// The debug log level +pub const debug : u32 = 4_u32; + +// A curious inner-module that's not exported that contains the binding +// 'core' so that macro-expanded references to core::error and such +// can be resolved within libcore. +#[doc(hidden)] // FIXME #3538 +mod core { + pub const error : u32 = 1_u32; + pub const warn : u32 = 2_u32; + pub const info : u32 = 3_u32; + pub const debug : u32 = 4_u32; +} + +// Similar to above. Some magic to make core testable. +#[cfg(test)] +mod std { + extern mod std(vers = "0.5"); + pub use std::test; +} + // Local Variables: // mode: rust; // fill-column: 78; diff --git a/src/libcore/core.rs b/src/libcore/core.rs deleted file mode 100644 index 4bc04566740..00000000000 --- a/src/libcore/core.rs +++ /dev/null @@ -1,81 +0,0 @@ -// Top-level, visible-everywhere definitions. - -// Export various ubiquitous types, constructors, methods. - -pub use option::{Some, None}; -pub use Option = option::Option; -pub use result::{Result, Ok, Err}; - -pub use Path = path::Path; -pub use GenericPath = path::GenericPath; -pub use WindowsPath = path::WindowsPath; -pub use PosixPath = path::PosixPath; - -pub use tuple::{CopyableTuple, ImmutableTuple, ExtendedTupleOps}; -pub use str::{StrSlice, Trimmable}; -pub use vec::{ConstVector, CopyableVector, ImmutableVector}; -pub use vec::{ImmutableEqVector, ImmutableCopyableVector}; -pub use vec::{MutableVector, MutableCopyableVector}; -pub use iter::{BaseIter, ExtendedIter, EqIter, CopyableIter}; -pub use iter::{CopyableOrderedIter, CopyableNonstrictIter, Times}; -pub use num::Num; -pub use ptr::Ptr; -pub use to_str::ToStr; - -// The following exports are the core operators and kinds -// The compiler has special knowlege of these so we must not duplicate them -// when compiling for testing -#[cfg(notest)] -pub use ops::{Const, Copy, Send, Owned}; -#[cfg(notest)] -pub use ops::{Drop}; -#[cfg(notest)] -pub use ops::{Add, Sub, Mul, Div, Modulo, Neg, BitAnd, BitOr, BitXor}; -#[cfg(notest)] -pub use ops::{Shl, Shr, Index}; - -#[cfg(test)] -extern mod coreops(name = "core", vers = "0.5"); - -#[cfg(test)] -pub use coreops::ops::{Const, Copy, Send, Owned}; -#[cfg(test)] -pub use coreops::ops::{Drop}; -#[cfg(test)] -pub use coreops::ops::{Add, Sub, Mul, Div, Modulo, Neg, BitAnd, BitOr}; -#[cfg(test)] -pub use coreops::ops::{BitXor}; -#[cfg(test)] -pub use coreops::ops::{Shl, Shr, Index}; - - -// Export the log levels as global constants. Higher levels mean -// more-verbosity. Error is the bottom level, default logging level is -// warn-and-below. - -/// The error log level -pub const error : u32 = 1_u32; -/// The warning log level -pub const warn : u32 = 2_u32; -/// The info log level -pub const info : u32 = 3_u32; -/// The debug log level -pub const debug : u32 = 4_u32; - -// A curious inner-module that's not exported that contains the binding -// 'core' so that macro-expanded references to core::error and such -// can be resolved within libcore. -#[doc(hidden)] // FIXME #3538 -mod core { - pub const error : u32 = 1_u32; - pub const warn : u32 = 2_u32; - pub const info : u32 = 3_u32; - pub const debug : u32 = 4_u32; -} - -// Similar to above. Some magic to make core testable. -#[cfg(test)] -mod std { - extern mod std(vers = "0.5"); - pub use std::test; -} diff --git a/src/libcore/either.rs b/src/libcore/either.rs index a8b0c117b8c..844f98acb26 100644 --- a/src/libcore/either.rs +++ b/src/libcore/either.rs @@ -132,25 +132,6 @@ pub pure fn unwrap_right(eith: Either) -> U { } impl Either : Eq { - #[cfg(stage0)] - pure fn eq(other: &Either) -> bool { - match self { - Left(ref a) => { - match (*other) { - Left(ref b) => (*a).eq(b), - Right(_) => false - } - } - Right(ref a) => { - match (*other) { - Left(_) => false, - Right(ref b) => (*a).eq(b) - } - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &Either) -> bool { match (*self) { Left(ref a) => { @@ -167,10 +148,6 @@ impl Either : Eq { } } } - #[cfg(stage0)] - pure fn ne(other: &Either) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &Either) -> bool { !(*self).eq(other) } } diff --git a/src/libcore/extfmt.rs b/src/libcore/extfmt.rs index a9989f5d37d..eb985a272df 100644 --- a/src/libcore/extfmt.rs +++ b/src/libcore/extfmt.rs @@ -438,21 +438,6 @@ pub mod rt { pub enum PadMode { PadSigned, PadUnsigned, PadNozero, PadFloat } pub impl PadMode : Eq { - #[cfg(stage0)] - 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 - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &PadMode) -> bool { match ((*self), (*other)) { (PadSigned, PadSigned) => true, @@ -465,10 +450,6 @@ pub mod rt { (PadFloat, _) => false } } - #[cfg(stage0)] - pure fn ne(other: &PadMode) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &PadMode) -> bool { !(*self).eq(other) } } diff --git a/src/libcore/float.rs b/src/libcore/float.rs index 1e218f1cba3..a5740c71323 100644 --- a/src/libcore/float.rs +++ b/src/libcore/float.rs @@ -400,38 +400,14 @@ pub pure fn cos(x: float) -> float { f64::cos(x as f64) as float } pub pure fn tan(x: float) -> float { f64::tan(x as f64) as float } impl float : Eq { - #[cfg(stage0)] - pub pure fn eq(other: &float) -> bool { self == (*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &float) -> bool { (*self) == (*other) } - #[cfg(stage0)] - pub pure fn ne(other: &float) -> bool { self != (*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &float) -> bool { (*self) != (*other) } } impl float : Ord { - #[cfg(stage0)] - pub pure fn lt(other: &float) -> bool { self < (*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn lt(&self, other: &float) -> bool { (*self) < (*other) } - #[cfg(stage0)] - pub pure fn le(other: &float) -> bool { self <= (*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn le(&self, other: &float) -> bool { (*self) <= (*other) } - #[cfg(stage0)] - pub pure fn ge(other: &float) -> bool { self >= (*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ge(&self, other: &float) -> bool { (*self) >= (*other) } - #[cfg(stage0)] - pub pure fn gt(other: &float) -> bool { self > (*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn gt(&self, other: &float) -> bool { (*self) > (*other) } } diff --git a/src/libcore/int-template.rs b/src/libcore/int-template.rs index 78f85fce3ec..e1383ba5ac2 100644 --- a/src/libcore/int-template.rs +++ b/src/libcore/int-template.rs @@ -55,38 +55,14 @@ pub pure fn abs(i: T) -> T { } impl T : Ord { - #[cfg(stage0)] - pure fn lt(other: &T) -> bool { return self < (*other); } - #[cfg(stage1)] - #[cfg(stage2)] pure fn lt(&self, other: &T) -> bool { return (*self) < (*other); } - #[cfg(stage0)] - pure fn le(other: &T) -> bool { return self <= (*other); } - #[cfg(stage1)] - #[cfg(stage2)] pure fn le(&self, other: &T) -> bool { return (*self) <= (*other); } - #[cfg(stage0)] - pure fn ge(other: &T) -> bool { return self >= (*other); } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ge(&self, other: &T) -> bool { return (*self) >= (*other); } - #[cfg(stage0)] - pure fn gt(other: &T) -> bool { return self > (*other); } - #[cfg(stage1)] - #[cfg(stage2)] pure fn gt(&self, other: &T) -> bool { return (*self) > (*other); } } impl T : Eq { - #[cfg(stage0)] - pure fn eq(other: &T) -> bool { return self == (*other); } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &T) -> bool { return (*self) == (*other); } - #[cfg(stage0)] - pure fn ne(other: &T) -> bool { return self != (*other); } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &T) -> bool { return (*self) != (*other); } } diff --git a/src/libcore/io.rs b/src/libcore/io.rs index a498adc1788..aa2eccfb343 100644 --- a/src/libcore/io.rs +++ b/src/libcore/io.rs @@ -516,25 +516,12 @@ pub enum FileFlag { Append, Create, Truncate, NoFlag, } pub enum WriterType { Screen, File } pub impl WriterType : Eq { - #[cfg(stage0)] - pure fn eq(other: &WriterType) -> bool { - match (self, (*other)) { - (Screen, Screen) | (File, File) => true, - (Screen, _) | (File, _) => false - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &WriterType) -> bool { match ((*self), (*other)) { (Screen, Screen) | (File, File) => true, (Screen, _) | (File, _) => false } } - #[cfg(stage0)] - pure fn ne(other: &WriterType) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &WriterType) -> bool { !(*self).eq(other) } } diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 1c47bc7f1ba..e5fcc7e83eb 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -301,26 +301,6 @@ impl Option { } impl Option : Eq { - #[cfg(stage0)] - pure fn eq(other: &Option) -> bool { - match self { - None => { - match (*other) { - None => true, - Some(_) => false - } - } - Some(ref self_contents) => { - match (*other) { - None => false, - Some(ref other_contents) => - (*self_contents).eq(other_contents) - } - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &Option) -> bool { match (*self) { None => { @@ -338,10 +318,6 @@ impl Option : Eq { } } } - #[cfg(stage0)] - pure fn ne(other: &Option) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &Option) -> bool { !(*self).eq(other) } } diff --git a/src/libcore/owned.rs b/src/libcore/owned.rs index 62fffde7f16..aaee987b4bd 100644 --- a/src/libcore/owned.rs +++ b/src/libcore/owned.rs @@ -7,38 +7,14 @@ use cmp::{Eq, Ord}; impl ~const T : Eq { - #[cfg(stage0)] - pure fn eq(other: &~const T) -> bool { *self == *(*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &~const T) -> bool { *(*self) == *(*other) } - #[cfg(stage0)] - pure fn ne(other: &~const T) -> bool { *self != *(*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &~const T) -> bool { *(*self) != *(*other) } } impl ~const T : Ord { - #[cfg(stage0)] - pure fn lt(other: &~const T) -> bool { *self < *(*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn lt(&self, other: &~const T) -> bool { *(*self) < *(*other) } - #[cfg(stage0)] - pure fn le(other: &~const T) -> bool { *self <= *(*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn le(&self, other: &~const T) -> bool { *(*self) <= *(*other) } - #[cfg(stage0)] - pure fn ge(other: &~const T) -> bool { *self >= *(*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ge(&self, other: &~const T) -> bool { *(*self) >= *(*other) } - #[cfg(stage0)] - pure fn gt(other: &~const T) -> bool { *self > *(*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn gt(&self, other: &~const T) -> bool { *(*self) > *(*other) } } diff --git a/src/libcore/path.rs b/src/libcore/path.rs index 8b5e383ed94..f0fefee9d06 100644 --- a/src/libcore/path.rs +++ b/src/libcore/path.rs @@ -344,44 +344,20 @@ impl PosixPath : ToStr { } impl PosixPath : Eq { - #[cfg(stage0)] - pure fn eq(other: &PosixPath) -> bool { - return self.is_absolute == (*other).is_absolute && - self.components == (*other).components; - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &PosixPath) -> bool { return (*self).is_absolute == (*other).is_absolute && (*self).components == (*other).components; } - #[cfg(stage0)] - pure fn ne(other: &PosixPath) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &PosixPath) -> bool { !(*self).eq(other) } } impl WindowsPath : Eq { - #[cfg(stage0)] - 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; - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &WindowsPath) -> bool { return (*self).host == (*other).host && (*self).device == (*other).device && (*self).is_absolute == (*other).is_absolute && (*self).components == (*other).components; } - #[cfg(stage0)] - pure fn ne(other: &WindowsPath) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &WindowsPath) -> bool { !(*self).eq(other) } } diff --git a/src/libcore/pipes.rs b/src/libcore/pipes.rs index 8b05f63752f..9a6f05fe405 100644 --- a/src/libcore/pipes.rs +++ b/src/libcore/pipes.rs @@ -98,19 +98,9 @@ enum State { } impl State : Eq { - #[cfg(stage0)] - pure fn eq(other: &State) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &State) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &State) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &State) -> bool { !(*self).eq(other) } } diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 7cba022e7c3..d1566735a3f 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -208,75 +208,31 @@ impl *mut T: Ptr { // Equality for pointers impl *const T : Eq { - #[cfg(stage0)] - 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; - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &*const T) -> bool unsafe { let a: uint = cast::reinterpret_cast(&(*self)); let b: uint = cast::reinterpret_cast(&(*other)); return a == b; } - #[cfg(stage0)] - pure fn ne(other: &*const T) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &*const T) -> bool { !(*self).eq(other) } } // Comparison for pointers impl *const T : Ord { - #[cfg(stage0)] - 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; - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn lt(&self, other: &*const T) -> bool unsafe { let a: uint = cast::reinterpret_cast(&(*self)); let b: uint = cast::reinterpret_cast(&(*other)); return a < b; } - #[cfg(stage0)] - 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; - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn le(&self, other: &*const T) -> bool unsafe { let a: uint = cast::reinterpret_cast(&(*self)); let b: uint = cast::reinterpret_cast(&(*other)); return a <= b; } - #[cfg(stage0)] - 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; - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ge(&self, other: &*const T) -> bool unsafe { let a: uint = cast::reinterpret_cast(&(*self)); let b: uint = cast::reinterpret_cast(&(*other)); return a >= b; } - #[cfg(stage0)] - 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)] pure fn gt(&self, other: &*const T) -> bool unsafe { let a: uint = cast::reinterpret_cast(&(*self)); let b: uint = cast::reinterpret_cast(&(*other)); @@ -286,17 +242,9 @@ impl *const T : Ord { // Equality for region pointers impl &const T : Eq { - #[cfg(stage0)] - pure fn eq(other: & &self/const T) -> bool { return *self == *(*other); } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: & &self/const T) -> bool { return *(*self) == *(*other); } - #[cfg(stage0)] - pure fn ne(other: & &self/const T) -> bool { return *self != *(*other); } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: & &self/const T) -> bool { return *(*self) != *(*other); } @@ -304,31 +252,15 @@ impl &const T : Eq { // Comparison for region pointers impl &const T : Ord { - #[cfg(stage0)] - pure fn lt(other: & &self/const T) -> bool { *self < *(*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn lt(&self, other: & &self/const T) -> bool { *(*self) < *(*other) } - #[cfg(stage0)] - pure fn le(other: & &self/const T) -> bool { *self <= *(*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn le(&self, other: & &self/const T) -> bool { *(*self) <= *(*other) } - #[cfg(stage0)] - pure fn ge(other: & &self/const T) -> bool { *self >= *(*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ge(&self, other: & &self/const T) -> bool { *(*self) >= *(*other) } - #[cfg(stage0)] - pure fn gt(other: & &self/const T) -> bool { *self > *(*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn gt(&self, other: & &self/const T) -> bool { *(*self) > *(*other) } diff --git a/src/libcore/repr.rs b/src/libcore/repr.rs index 0eee413cdad..3bec87e0af6 100644 --- a/src/libcore/repr.rs +++ b/src/libcore/repr.rs @@ -516,19 +516,9 @@ enum EnumVisitState { } impl EnumVisitState : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &EnumVisitState) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &EnumVisitState) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &EnumVisitState) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &EnumVisitState) -> bool { !(*self).eq(other) } } diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 5c59f429fd4..20d4bd81056 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -365,25 +365,6 @@ pub fn unwrap_err(res: Result) -> U { } impl Result : Eq { - #[cfg(stage0)] - pure fn eq(other: &Result) -> bool { - match self { - Ok(ref e0a) => { - match (*other) { - Ok(ref e0b) => *e0a == *e0b, - _ => false - } - } - Err(ref e0a) => { - match (*other) { - Err(ref e0b) => *e0a == *e0b, - _ => false - } - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &Result) -> bool { match (*self) { Ok(ref e0a) => { @@ -400,10 +381,6 @@ impl Result : Eq { } } } - #[cfg(stage0)] - pure fn ne(other: &Result) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &Result) -> bool { !(*self).eq(other) } } diff --git a/src/libcore/str.rs b/src/libcore/str.rs index 2d8d1cd9fd8..410d18d6665 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -737,139 +737,61 @@ pure fn gt(a: &str, b: &str) -> bool { impl &str : Eq { #[inline(always)] - #[cfg(stage0)] - pure fn eq(other: & &self/str) -> bool { - eq_slice(self, (*other)) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: & &self/str) -> bool { eq_slice((*self), (*other)) } #[inline(always)] - #[cfg(stage0)] - pure fn ne(other: & &self/str) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: & &self/str) -> bool { !(*self).eq(other) } } impl ~str : Eq { #[inline(always)] - #[cfg(stage0)] - pure fn eq(other: &~str) -> bool { - eq_slice(self, (*other)) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &~str) -> bool { eq_slice((*self), (*other)) } #[inline(always)] - #[cfg(stage0)] - pure fn ne(other: &~str) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &~str) -> bool { !(*self).eq(other) } } impl @str : Eq { #[inline(always)] - #[cfg(stage0)] - pure fn eq(other: &@str) -> bool { - eq_slice(self, (*other)) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &@str) -> bool { eq_slice((*self), (*other)) } #[inline(always)] - #[cfg(stage0)] - pure fn ne(other: &@str) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &@str) -> bool { !(*self).eq(other) } } impl ~str : Ord { #[inline(always)] - #[cfg(stage0)] - pure fn lt(other: &~str) -> bool { lt(self, (*other)) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn lt(&self, other: &~str) -> bool { lt((*self), (*other)) } #[inline(always)] - #[cfg(stage0)] - pure fn le(other: &~str) -> bool { le(self, (*other)) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn le(&self, other: &~str) -> bool { le((*self), (*other)) } #[inline(always)] - #[cfg(stage0)] - pure fn ge(other: &~str) -> bool { ge(self, (*other)) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ge(&self, other: &~str) -> bool { ge((*self), (*other)) } #[inline(always)] - #[cfg(stage0)] - pure fn gt(other: &~str) -> bool { gt(self, (*other)) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn gt(&self, other: &~str) -> bool { gt((*self), (*other)) } } impl &str : Ord { #[inline(always)] - #[cfg(stage0)] - pure fn lt(other: & &self/str) -> bool { lt(self, (*other)) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn lt(&self, other: & &self/str) -> bool { lt((*self), (*other)) } #[inline(always)] - #[cfg(stage0)] - pure fn le(other: & &self/str) -> bool { le(self, (*other)) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn le(&self, other: & &self/str) -> bool { le((*self), (*other)) } #[inline(always)] - #[cfg(stage0)] - pure fn ge(other: & &self/str) -> bool { ge(self, (*other)) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ge(&self, other: & &self/str) -> bool { ge((*self), (*other)) } #[inline(always)] - #[cfg(stage0)] - pure fn gt(other: & &self/str) -> bool { gt(self, (*other)) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn gt(&self, other: & &self/str) -> bool { gt((*self), (*other)) } } impl @str : Ord { #[inline(always)] - #[cfg(stage0)] - pure fn lt(other: &@str) -> bool { lt(self, (*other)) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn lt(&self, other: &@str) -> bool { lt((*self), (*other)) } #[inline(always)] - #[cfg(stage0)] - pure fn le(other: &@str) -> bool { le(self, (*other)) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn le(&self, other: &@str) -> bool { le((*self), (*other)) } #[inline(always)] - #[cfg(stage0)] - pure fn ge(other: &@str) -> bool { ge(self, (*other)) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ge(&self, other: &@str) -> bool { ge((*self), (*other)) } #[inline(always)] - #[cfg(stage0)] - pure fn gt(other: &@str) -> bool { gt(self, (*other)) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn gt(&self, other: &@str) -> bool { gt((*self), (*other)) } } diff --git a/src/libcore/task.rs b/src/libcore/task.rs index 3a6fa2d3931..a2b5c3229ad 100644 --- a/src/libcore/task.rs +++ b/src/libcore/task.rs @@ -43,15 +43,7 @@ pub enum Task { } impl Task : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &Task) -> bool { *self == *(*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &Task) -> bool { *(*self) == *(*other) } - #[cfg(stage0)] - pure fn ne(other: &Task) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &Task) -> bool { !(*self).eq(other) } } @@ -72,25 +64,12 @@ pub enum TaskResult { } impl TaskResult : Eq { - #[cfg(stage0)] - pure fn eq(other: &TaskResult) -> bool { - match (self, (*other)) { - (Success, Success) | (Failure, Failure) => true, - (Success, _) | (Failure, _) => false - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &TaskResult) -> bool { match ((*self), (*other)) { (Success, Success) | (Failure, Failure) => true, (Success, _) | (Failure, _) => false } } - #[cfg(stage0)] - pure fn ne(other: &TaskResult) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &TaskResult) -> bool { !(*self).eq(other) } } @@ -114,43 +93,6 @@ pub enum SchedMode { } impl SchedMode : cmp::Eq { - #[cfg(stage0)] - 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 - } - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &SchedMode) -> bool { match (*self) { SingleThreaded => { @@ -185,12 +127,6 @@ impl SchedMode : cmp::Eq { } } } - #[cfg(stage0)] - pure fn ne(other: &SchedMode) -> bool { - !self.eq(other) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &SchedMode) -> bool { !(*self).eq(other) } diff --git a/src/libcore/task/local_data_priv.rs b/src/libcore/task/local_data_priv.rs index 02550f3470f..b8537373e65 100644 --- a/src/libcore/task/local_data_priv.rs +++ b/src/libcore/task/local_data_priv.rs @@ -7,23 +7,11 @@ pub trait LocalData { } impl @T: LocalData { } impl LocalData: Eq { - #[cfg(stage0)] - 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; - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, 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; } - #[cfg(stage0)] - pure fn ne(other: &@LocalData) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &@LocalData) -> bool { !(*self).eq(other) } } diff --git a/src/libcore/tuple.rs b/src/libcore/tuple.rs index 33ad2cc903b..78a3e3c8355 100644 --- a/src/libcore/tuple.rs +++ b/src/libcore/tuple.rs @@ -95,18 +95,6 @@ impl (~[A], ~[B]): ExtendedTupleOps { } impl (A, B) : Eq { - #[cfg(stage0)] - pure fn eq(other: &(A, B)) -> bool { - match self { - (ref self_a, ref self_b) => match other { - &(ref other_a, ref other_b) => { - (*self_a).eq(other_a) && (*self_b).eq(other_b) - } - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &(A, B)) -> bool { match (*self) { (ref self_a, ref self_b) => match other { @@ -116,31 +104,10 @@ impl (A, B) : Eq { } } } - #[cfg(stage0)] - pure fn ne(other: &(A, B)) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &(A, B)) -> bool { !(*self).eq(other) } } impl (A, B) : Ord { - #[cfg(stage0)] - pure fn lt(other: &(A, B)) -> bool { - match self { - (ref self_a, ref self_b) => { - match (*other) { - (ref other_a, ref 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; - } - } - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn lt(&self, other: &(A, B)) -> bool { match (*self) { (ref self_a, ref self_b) => { @@ -155,37 +122,12 @@ impl (A, B) : Ord { } } } - #[cfg(stage0)] - pure fn le(other: &(A, B)) -> bool { !(*other).lt(&self) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn le(&self, other: &(A, B)) -> bool { !(*other).lt(&(*self)) } - #[cfg(stage0)] - pure fn ge(other: &(A, B)) -> bool { !self.lt(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ge(&self, other: &(A, B)) -> bool { !(*self).lt(other) } - #[cfg(stage0)] - pure fn gt(other: &(A, B)) -> bool { (*other).lt(&self) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn gt(&self, other: &(A, B)) -> bool { (*other).lt(&(*self)) } } impl (A, B, C) : Eq { - #[cfg(stage0)] - pure fn eq(other: &(A, B, C)) -> bool { - match self { - (ref self_a, ref self_b, ref self_c) => match other { - &(ref other_a, ref other_b, ref other_c) => { - (*self_a).eq(other_a) && (*self_b).eq(other_b) - && (*self_c).eq(other_c) - } - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &(A, B, C)) -> bool { match (*self) { (ref self_a, ref self_b, ref self_c) => match other { @@ -196,33 +138,10 @@ impl (A, B, C) : Eq { } } } - #[cfg(stage0)] - pure fn ne(other: &(A, B, C)) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &(A, B, C)) -> bool { !(*self).eq(other) } } impl (A, B, C) : Ord { - #[cfg(stage0)] - pure fn lt(other: &(A, B, C)) -> bool { - match self { - (ref self_a, ref self_b, ref self_c) => { - match (*other) { - (ref other_a, ref other_b, ref 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; - } - } - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn lt(&self, other: &(A, B, C)) -> bool { match (*self) { (ref self_a, ref self_b, ref self_c) => { @@ -239,20 +158,8 @@ impl (A, B, C) : Ord { } } } - #[cfg(stage0)] - pure fn le(other: &(A, B, C)) -> bool { !(*other).lt(&self) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn le(&self, other: &(A, B, C)) -> bool { !(*other).lt(&(*self)) } - #[cfg(stage0)] - pure fn ge(other: &(A, B, C)) -> bool { !self.lt(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ge(&self, other: &(A, B, C)) -> bool { !(*self).lt(other) } - #[cfg(stage0)] - pure fn gt(other: &(A, B, C)) -> bool { (*other).lt(&self) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn gt(&self, other: &(A, B, C)) -> bool { (*other).lt(&(*self)) } } diff --git a/src/libcore/uint-template.rs b/src/libcore/uint-template.rs index 4f84f9acb7e..e96a6766570 100644 --- a/src/libcore/uint-template.rs +++ b/src/libcore/uint-template.rs @@ -49,38 +49,14 @@ pub pure fn compl(i: T) -> T { } impl T : Ord { - #[cfg(stage0)] - pure fn lt(other: &T) -> bool { self < (*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn lt(&self, other: &T) -> bool { (*self) < (*other) } - #[cfg(stage0)] - pure fn le(other: &T) -> bool { self <= (*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn le(&self, other: &T) -> bool { (*self) <= (*other) } - #[cfg(stage0)] - pure fn ge(other: &T) -> bool { self >= (*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ge(&self, other: &T) -> bool { (*self) >= (*other) } - #[cfg(stage0)] - pure fn gt(other: &T) -> bool { self > (*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn gt(&self, other: &T) -> bool { (*self) > (*other) } } impl T : Eq { - #[cfg(stage0)] - pure fn eq(other: &T) -> bool { return self == (*other); } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &T) -> bool { return (*self) == (*other); } - #[cfg(stage0)] - pure fn ne(other: &T) -> bool { return self != (*other); } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &T) -> bool { return (*self) != (*other); } } diff --git a/src/libcore/unit.rs b/src/libcore/unit.rs index 27960a09b24..6110b9eebff 100644 --- a/src/libcore/unit.rs +++ b/src/libcore/unit.rs @@ -11,38 +11,14 @@ Functions for the unit type. use cmp::{Eq, Ord}; impl () : Eq { - #[cfg(stage0)] - pure fn eq(_other: &()) -> bool { true } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, _other: &()) -> bool { true } - #[cfg(stage0)] - pure fn ne(_other: &()) -> bool { false } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, _other: &()) -> bool { false } } impl () : Ord { - #[cfg(stage0)] - pure fn lt(_other: &()) -> bool { false } - #[cfg(stage1)] - #[cfg(stage2)] pure fn lt(&self, _other: &()) -> bool { false } - #[cfg(stage0)] - pure fn le(_other: &()) -> bool { true } - #[cfg(stage1)] - #[cfg(stage2)] pure fn le(&self, _other: &()) -> bool { true } - #[cfg(stage0)] - pure fn ge(_other: &()) -> bool { true } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ge(&self, _other: &()) -> bool { true } - #[cfg(stage0)] - pure fn gt(_other: &()) -> bool { false } - #[cfg(stage1)] - #[cfg(stage2)] pure fn gt(&self, _other: &()) -> bool { false } } diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs index 087ce42b28a..47864d0b562 100644 --- a/src/libcore/vec.rs +++ b/src/libcore/vec.rs @@ -1347,47 +1347,23 @@ pure fn eq(a: &[T], b: &[T]) -> bool { impl &[T] : Eq { #[inline(always)] - #[cfg(stage0)] - pure fn eq(other: & &self/[T]) -> bool { eq(self, (*other)) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: & &self/[T]) -> bool { eq((*self), (*other)) } #[inline(always)] - #[cfg(stage0)] - pure fn ne(other: & &self/[T]) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: & &self/[T]) -> bool { !(*self).eq(other) } } impl ~[T] : Eq { #[inline(always)] - #[cfg(stage0)] - pure fn eq(other: &~[T]) -> bool { eq(self, (*other)) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &~[T]) -> bool { eq((*self), (*other)) } #[inline(always)] - #[cfg(stage0)] - pure fn ne(other: &~[T]) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &~[T]) -> bool { !(*self).eq(other) } } impl @[T] : Eq { #[inline(always)] - #[cfg(stage0)] - pure fn eq(other: &@[T]) -> bool { eq(self, (*other)) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &@[T]) -> bool { eq((*self), (*other)) } #[inline(always)] - #[cfg(stage0)] - pure fn ne(other: &@[T]) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &@[T]) -> bool { !(*self).eq(other) } } @@ -1414,82 +1390,34 @@ pure fn gt(a: &[T], b: &[T]) -> bool { lt(b, a) } impl &[T] : Ord { #[inline(always)] - #[cfg(stage0)] - pure fn lt(other: & &self/[T]) -> bool { lt(self, (*other)) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn lt(&self, other: & &self/[T]) -> bool { lt((*self), (*other)) } #[inline(always)] - #[cfg(stage0)] - pure fn le(other: & &self/[T]) -> bool { le(self, (*other)) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn le(&self, other: & &self/[T]) -> bool { le((*self), (*other)) } #[inline(always)] - #[cfg(stage0)] - pure fn ge(other: & &self/[T]) -> bool { ge(self, (*other)) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ge(&self, other: & &self/[T]) -> bool { ge((*self), (*other)) } #[inline(always)] - #[cfg(stage0)] - pure fn gt(other: & &self/[T]) -> bool { gt(self, (*other)) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn gt(&self, other: & &self/[T]) -> bool { gt((*self), (*other)) } } impl ~[T] : Ord { #[inline(always)] - #[cfg(stage0)] - pure fn lt(other: &~[T]) -> bool { lt(self, (*other)) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn lt(&self, other: &~[T]) -> bool { lt((*self), (*other)) } #[inline(always)] - #[cfg(stage0)] - pure fn le(other: &~[T]) -> bool { le(self, (*other)) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn le(&self, other: &~[T]) -> bool { le((*self), (*other)) } #[inline(always)] - #[cfg(stage0)] - pure fn ge(other: &~[T]) -> bool { ge(self, (*other)) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ge(&self, other: &~[T]) -> bool { ge((*self), (*other)) } #[inline(always)] - #[cfg(stage0)] - pure fn gt(other: &~[T]) -> bool { gt(self, (*other)) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn gt(&self, other: &~[T]) -> bool { gt((*self), (*other)) } } impl @[T] : Ord { #[inline(always)] - #[cfg(stage0)] - pure fn lt(other: &@[T]) -> bool { lt(self, (*other)) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn lt(&self, other: &@[T]) -> bool { lt((*self), (*other)) } #[inline(always)] - #[cfg(stage0)] - pure fn le(other: &@[T]) -> bool { le(self, (*other)) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn le(&self, other: &@[T]) -> bool { le((*self), (*other)) } #[inline(always)] - #[cfg(stage0)] - pure fn ge(other: &@[T]) -> bool { ge(self, (*other)) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ge(&self, other: &@[T]) -> bool { ge((*self), (*other)) } #[inline(always)] - #[cfg(stage0)] - pure fn gt(other: &@[T]) -> bool { gt(self, (*other)) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn gt(&self, other: &@[T]) -> bool { gt((*self), (*other)) } } diff --git a/src/libfuzzer/fuzzer.rc b/src/libfuzzer/fuzzer.rc index 805e7b7d823..d8f4fd97c66 100644 --- a/src/libfuzzer/fuzzer.rc +++ b/src/libfuzzer/fuzzer.rc @@ -34,16 +34,6 @@ use syntax::diagnostic; enum test_mode { tm_converge, tm_run, } type context = { mode: test_mode }; // + rng -#[cfg(stage0)] -impl test_mode : cmp::Eq { - pure fn eq(other: &test_mode) -> bool { - (self as uint) == ((*other) as uint) - } - pure fn ne(other: &test_mode) -> bool { !self.eq(other) } -} - -#[cfg(stage1)] -#[cfg(stage2)] impl test_mode : cmp::Eq { pure fn eq(&self, other: &test_mode) -> bool { ((*self) as uint) == ((*other) as uint) diff --git a/src/librustc/alternate_crate.rc b/src/librustc/alternate_crate.rc deleted file mode 100644 index 1d2d0c1f77c..00000000000 --- a/src/librustc/alternate_crate.rc +++ /dev/null @@ -1,501 +0,0 @@ -// -*- rust -*- - -#[link(name = "rustc", - vers = "0.5", - uuid = "0ce89b41-2f92-459e-bbc1-8f5fe32f16cf", - url = "https://github.com/mozilla/rust/tree/master/src/rustc")]; - -#[comment = "The Rust compiler"]; -#[license = "MIT"]; -#[crate_type = "lib"]; - -#[no_core]; - -#[legacy_modes]; -#[legacy_exports]; - -#[allow(vecs_implicitly_copyable)]; -#[allow(non_camel_case_types)]; -#[allow(deprecated_mode)]; -#[allow(deprecated_pattern)]; - -extern mod core(vers = "0.5"); -extern mod std(vers = "0.5"); -extern mod syntax(vers = "0.5"); - -use core::*; - -/* -Alternate names for some modules. - -I am using this to help extract metadata into its own crate. In metadata.rs -it redefines all these modules in order to gate access from metadata to the -rest of the compiler, then uses these to access the original implementation. -*/ -use util_ = util; -use lib_ = lib; -use driver_ = driver; -use middle_ = middle; -use back_ = back; - -mod middle { - #[legacy_exports]; - mod trans { - #[legacy_exports]; - #[legacy_exports] - #[path = "middle/trans/inline.rs"] - mod inline; - #[legacy_exports] - #[path = "middle/trans/monomorphize.rs"] - mod monomorphize; - #[legacy_exports] - #[path = "middle/trans/controlflow.rs"] - mod controlflow; - #[legacy_exports] - #[path = "middle/trans/glue.rs"] - mod glue; - #[legacy_exports] - #[path = "middle/trans/datum.rs"] - mod datum; - #[legacy_exports] - #[path = "middle/trans/callee.rs"] - mod callee; - #[legacy_exports] - #[path = "middle/trans/expr.rs"] - mod expr; - #[legacy_exports] - #[path = "middle/trans/common.rs"] - mod common; - #[legacy_exports] - #[path = "middle/trans/consts.rs"] - mod consts; - #[legacy_exports] - #[path = "middle/trans/type_of.rs"] - mod type_of; - #[legacy_exports] - #[path = "middle/trans/build.rs"] - mod build; - #[legacy_exports] - #[path = "middle/trans/base.rs"] - mod base; - #[legacy_exports] - #[path = "middle/trans/alt.rs"] - mod alt; - #[legacy_exports] - #[path = "middle/trans/uniq.rs"] - mod uniq; - #[legacy_exports] - #[path = "middle/trans/closure.rs"] - mod closure; - #[legacy_exports] - #[path = "middle/trans/tvec.rs"] - mod tvec; - #[legacy_exports] - #[path = "middle/trans/meth.rs"] - mod meth; - #[legacy_exports] - #[path = "middle/trans/foreign.rs"] - mod foreign; - #[legacy_exports] - #[path = "middle/trans/reflect.rs"] - mod reflect; - #[legacy_exports] - #[path = "middle/trans/shape.rs"] - mod shape; - #[legacy_exports] - #[path = "middle/trans/debuginfo.rs"] - mod debuginfo; - #[legacy_exports] - #[path = "middle/trans/type_use.rs"] - mod type_use; - #[legacy_exports] - #[path = "middle/trans/reachable.rs"] - mod reachable; - #[path = "middle/trans/machine.rs"] - mod machine; - #[path = "middle/trans/deriving.rs"] - mod deriving; - } - #[legacy_exports] - #[path = "middle/ty.rs"] - mod ty; - #[legacy_exports] - #[path = "middle/resolve.rs"] - mod resolve; - #[path = "middle/typeck.rs"] - #[merge = "middle/typeck/mod.rs"] - pub mod typeck; - #[legacy_exports] - #[path = "middle/check_loop.rs"] - mod check_loop; - #[legacy_exports] - #[path = "middle/check_alt.rs"] - mod check_alt; - #[legacy_exports] - #[path = "middle/check_const.rs"] - mod check_const; - #[legacy_exports] - #[path = "middle/lint.rs"] - mod lint; - #[path = "middle/borrowck.rs"] - #[merge = "middle/borrowck/mod.rs"] - mod borrowck; - #[legacy_exports] - #[path = "middle/mem_categorization.rs"] - mod mem_categorization; - #[legacy_exports] - #[path = "middle/liveness.rs"] - mod liveness; - #[legacy_exports] - #[path = "middle/kind.rs"] - mod kind; - #[legacy_exports] - #[path = "middle/freevars.rs"] - mod freevars; - #[legacy_exports] - #[path = "middle/capture.rs"] - mod capture; - #[legacy_exports] - #[path = "middle/pat_util.rs"] - mod pat_util; - #[legacy_exports] - #[path = "middle/region.rs"] - mod region; - #[legacy_exports] - #[path = "middle/const_eval.rs"] - mod const_eval; - #[legacy_exports] - #[path = "middle/astencode.rs"] - mod astencode; - #[legacy_exports] - #[path = "middle/lang_items.rs"] - mod lang_items; - #[legacy_exports] - #[path = "middle/privacy.rs"] - mod privacy; -} - -mod front { - #[legacy_exports]; - #[legacy_exports] - #[path = "front/config.rs"] - mod config; - #[legacy_exports] - #[path = "front/test.rs"] - mod test; - #[legacy_exports] - #[path = "front/core_inject.rs"] - mod core_inject; - #[legacy_exports] - #[path = "front/intrinsic_inject.rs"] - mod intrinsic_inject; -} - -mod back { - #[legacy_exports]; - #[legacy_exports] - #[path = "back/link.rs"] - mod link; - #[legacy_exports] - #[path = "back/abi.rs"] - mod abi; - #[legacy_exports] - #[path = "back/upcall.rs"] - mod upcall; - #[legacy_exports] - #[path = "back/x86.rs"] - mod x86; - #[legacy_exports] - #[path = "back/x86_64.rs"] - mod x86_64; - #[legacy_exports] - #[path = "back/rpath.rs"] - mod rpath; - #[legacy_exports] - #[path = "back/target_strs.rs"] - mod target_strs; -} - -#[merge = "metadata/mod.rs"] -mod metadata; - -#[merge = "driver/mod.rs"] -mod driver; - -mod util { - #[legacy_exports]; - #[legacy_exports] - #[path = "util/common.rs"] - mod common; - #[legacy_exports] - #[path = "util/ppaux.rs"] - mod ppaux; -} - -mod lib { - #[legacy_exports]; - #[legacy_exports] - #[path = "lib/llvm.rs"] - mod llvm; -} - -use result::{Ok, Err}; -use io::ReaderUtil; -use std::getopts; -use std::map::HashMap; -use getopts::{opt_present}; -use getopts::groups; -use syntax::codemap; -use syntax::diagnostic; -use driver::driver::{host_triple, optgroups, early_error, - str_input, file_input, build_session_options, - build_session, build_configuration, parse_pretty, - pp_mode, pretty_print_input, list_metadata, - compile_input}; -use driver::session; -use middle::lint; - -fn version(argv0: &str) { - let mut vers = ~"unknown version"; - let env_vers = env!("CFG_VERSION"); - if env_vers.len() != 0 { vers = env_vers; } - io::println(fmt!("%s %s", argv0, vers)); - io::println(fmt!("host: %s", host_triple())); -} - -fn usage(argv0: &str) { - let message = fmt!("Usage: %s [OPTIONS] INPUT", argv0); - io::println(groups::usage(message, optgroups()) + - ~"Additional help: - -W help Print 'lint' options and default settings - -Z help Print internal options for debugging rustc -"); -} - -fn describe_warnings() { - io::println(fmt!(" -Available lint options: - -W Warn about - -A Allow - -D Deny - -F Forbid (deny, and deny all overrides) -")); - - let lint_dict = lint::get_lint_dict(); - let mut max_key = 0; - for lint_dict.each_key |k| { max_key = uint::max(k.len(), max_key); } - fn padded(max: uint, s: &str) -> ~str { - str::from_bytes(vec::from_elem(max - s.len(), ' ' as u8)) + s - } - io::println(fmt!("\nAvailable lint checks:\n")); - io::println(fmt!(" %s %7.7s %s", - padded(max_key, ~"name"), ~"default", ~"meaning")); - io::println(fmt!(" %s %7.7s %s\n", - padded(max_key, ~"----"), ~"-------", ~"-------")); - for lint_dict.each |k, v| { - let k = str::replace(k, ~"_", ~"-"); - io::println(fmt!(" %s %7.7s %s", - padded(max_key, k), - match v.default { - lint::allow => ~"allow", - lint::warn => ~"warn", - lint::deny => ~"deny", - lint::forbid => ~"forbid" - }, - v.desc)); - } - io::println(~""); -} - -fn describe_debug_flags() { - io::println(fmt!("\nAvailable debug options:\n")); - for session::debugging_opts_map().each |pair| { - let (name, desc, _) = *pair; - io::println(fmt!(" -Z %-20s -- %s", name, desc)); - } -} - -fn run_compiler(args: &~[~str], demitter: diagnostic::emitter) { - // Don't display log spew by default. Can override with RUST_LOG. - logging::console_off(); - - let mut args = *args; - let binary = args.shift(); - - if args.is_empty() { usage(binary); return; } - - let matches = - match getopts::groups::getopts(args, optgroups()) { - Ok(m) => m, - Err(f) => { - early_error(demitter, getopts::fail_str(f)) - } - }; - - if opt_present(matches, ~"h") || opt_present(matches, ~"help") { - usage(binary); - return; - } - - let lint_flags = vec::append(getopts::opt_strs(matches, ~"W"), - getopts::opt_strs(matches, ~"warn")); - if lint_flags.contains(&~"help") { - describe_warnings(); - return; - } - - if getopts::opt_strs(matches, ~"Z").contains(&~"help") { - describe_debug_flags(); - return; - } - - if opt_present(matches, ~"v") || opt_present(matches, ~"version") { - version(binary); - return; - } - let input = match vec::len(matches.free) { - 0u => early_error(demitter, ~"no input filename given"), - 1u => { - let ifile = matches.free[0]; - if ifile == ~"-" { - let src = str::from_bytes(io::stdin().read_whole_stream()); - str_input(src) - } else { - file_input(Path(ifile)) - } - } - _ => early_error(demitter, ~"multiple input filenames provided") - }; - - let sopts = build_session_options(binary, matches, demitter); - let sess = build_session(sopts, demitter); - let odir = getopts::opt_maybe_str(matches, ~"out-dir"); - let odir = odir.map(|o| Path(*o)); - let ofile = getopts::opt_maybe_str(matches, ~"o"); - let ofile = ofile.map(|o| Path(*o)); - let cfg = build_configuration(sess, binary, input); - let pretty = - option::map(&getopts::opt_default(matches, ~"pretty", - ~"normal"), - |a| parse_pretty(sess, *a) ); - match pretty { - Some::(ppm) => { - pretty_print_input(sess, cfg, input, ppm); - return; - } - None:: => {/* continue */ } - } - let ls = opt_present(matches, ~"ls"); - if ls { - match input { - file_input(ifile) => { - list_metadata(sess, &ifile, io::stdout()); - } - str_input(_) => { - early_error(demitter, ~"can not list metadata for stdin"); - } - } - return; - } - - compile_input(sess, cfg, input, &odir, &ofile); -} - -enum monitor_msg { - fatal, - done, -} - -impl monitor_msg : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &monitor_msg) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] - pure fn eq(&self, other: &monitor_msg) -> bool { - ((*self) as uint) == ((*other) as uint) - } - #[cfg(stage0)] - pure fn ne(other: &monitor_msg) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] - pure fn ne(&self, other: &monitor_msg) -> bool { !(*self).eq(other) } -} - -/* -This is a sanity check that any failure of the compiler is performed -through the diagnostic module and reported properly - we shouldn't be calling -plain-old-fail on any execution path that might be taken. Since we have -console logging off by default, hitting a plain fail statement would make the -compiler silently exit, which would be terrible. - -This method wraps the compiler in a subtask and injects a function into the -diagnostic emitter which records when we hit a fatal error. If the task -fails without recording a fatal error then we've encountered a compiler -bug and need to present an error. -*/ -fn monitor(+f: fn~(diagnostic::emitter)) { - let p = comm::Port(); - let ch = comm::Chan(&p); - - match do task::try |move f| { - - // The 'diagnostics emitter'. Every error, warning, etc. should - // go through this function. - let demitter = fn@(cmsp: Option<(@codemap::CodeMap, codemap::span)>, - msg: &str, lvl: diagnostic::level) { - if lvl == diagnostic::fatal { - comm::send(ch, fatal); - } - diagnostic::emit(cmsp, msg, lvl); - }; - - struct finally { - ch: comm::Chan, - drop { comm::send(self.ch, done); } - } - - let _finally = finally { ch: ch }; - - f(demitter) - } { - result::Ok(_) => { /* fallthrough */ } - result::Err(_) => { - // Task failed without emitting a fatal diagnostic - if comm::recv(p) == done { - diagnostic::emit( - None, - diagnostic::ice_msg(~"unexpected failure"), - diagnostic::error); - - for [ - ~"the compiler hit an unexpected failure path. \ - this is a bug", - ~"try running with RUST_LOG=rustc=1,::rt::backtrace \ - to get further details and report the results \ - to github.com/mozilla/rust/issues" - ].each |note| { - diagnostic::emit(None, *note, diagnostic::note) - } - } - // Fail so the process returns a failure code - fail; - } - } -} - -fn main() { - let mut args = os::args(); - do monitor |move args, demitter| { - run_compiler(&args, demitter); - } -} - - -// Local Variables: -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs index a33ca6f8f39..36cbdf8c664 100644 --- a/src/librustc/back/link.rs +++ b/src/librustc/back/link.rs @@ -27,19 +27,9 @@ enum output_type { } impl output_type : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &output_type) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &output_type) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &output_type) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &output_type) -> bool { !(*self).eq(other) } } diff --git a/src/librustc/driver/driver.rs b/src/librustc/driver/driver.rs index ff6cf9fd3b4..9251b7d8374 100644 --- a/src/librustc/driver/driver.rs +++ b/src/librustc/driver/driver.rs @@ -141,19 +141,9 @@ enum compile_upto { } impl compile_upto : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &compile_upto) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &compile_upto) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &compile_upto) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &compile_upto) -> bool { !(*self).eq(other) } } diff --git a/src/librustc/driver/session.rs b/src/librustc/driver/session.rs index 8115c4d1885..7614bdbb25b 100644 --- a/src/librustc/driver/session.rs +++ b/src/librustc/driver/session.rs @@ -13,38 +13,18 @@ use middle::lint; enum os { os_win32, os_macos, os_linux, os_freebsd, } impl os : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &os) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &os) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &os) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &os) -> bool { !(*self).eq(other) } } enum arch { arch_x86, arch_x86_64, arch_arm, } impl arch : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &arch) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &arch) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &arch) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &arch) -> bool { !(*self).eq(other) } } @@ -111,19 +91,9 @@ enum OptLevel { } impl OptLevel : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &OptLevel) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &OptLevel) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &OptLevel) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &OptLevel) -> bool { !(*self).eq(other) } } diff --git a/src/librustc/lib/llvm.rs b/src/librustc/lib/llvm.rs index 4da3d41dee6..fa364700b74 100644 --- a/src/librustc/lib/llvm.rs +++ b/src/librustc/lib/llvm.rs @@ -131,45 +131,6 @@ enum TypeKind { } impl TypeKind : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &TypeKind) -> bool { - match (self, (*other)) { - (Void, Void) => true, - (Half, Half) => true, - (Float, Float) => true, - (Double, Double) => true, - (X86_FP80, X86_FP80) => true, - (FP128, FP128) => true, - (PPC_FP128, PPC_FP128) => true, - (Label, Label) => true, - (Integer, Integer) => true, - (Function, Function) => true, - (Struct, Struct) => true, - (Array, Array) => true, - (Pointer, Pointer) => true, - (Vector, Vector) => true, - (Metadata, Metadata) => true, - (X86_MMX, X86_MMX) => true, - (Void, _) => false, - (Half, _) => false, - (Float, _) => false, - (Double, _) => false, - (X86_FP80, _) => false, - (FP128, _) => false, - (PPC_FP128, _) => false, - (Label, _) => false, - (Integer, _) => false, - (Function, _) => false, - (Struct, _) => false, - (Array, _) => false, - (Pointer, _) => false, - (Vector, _) => false, - (Metadata, _) => false, - (X86_MMX, _) => false, - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &TypeKind) -> bool { match ((*self), (*other)) { (Void, Void) => true, @@ -206,10 +167,6 @@ impl TypeKind : cmp::Eq { (X86_MMX, _) => false, } } - #[cfg(stage0)] - pure fn ne(other: &TypeKind) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &TypeKind) -> bool { !(*self).eq(other) } } diff --git a/src/librustc/metadata/decoder.rs b/src/librustc/metadata/decoder.rs index ec100b2e3d6..62235efb14d 100644 --- a/src/librustc/metadata/decoder.rs +++ b/src/librustc/metadata/decoder.rs @@ -140,19 +140,9 @@ enum Family { } impl Family : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &Family) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &Family) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &Family) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &Family) -> bool { !(*self).eq(other) } } diff --git a/src/librustc/middle/borrowck.rs b/src/librustc/middle/borrowck.rs index 25e184c2c02..b229e810862 100644 --- a/src/librustc/middle/borrowck.rs +++ b/src/librustc/middle/borrowck.rs @@ -323,50 +323,6 @@ enum bckerr_code { } impl bckerr_code : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &bckerr_code) -> bool { - match self { - err_mut_uniq => { - match (*other) { - err_mut_uniq => true, - _ => false - } - } - err_mut_variant => { - match (*other) { - err_mut_variant => true, - _ => false - } - } - err_root_not_permitted => { - match (*other) { - err_root_not_permitted => true, - _ => false - } - } - err_mutbl(e0a) => { - match (*other) { - err_mutbl(e0b) => e0a == e0b, - _ => false - } - } - err_out_of_root_scope(e0a, e1a) => { - match (*other) { - err_out_of_root_scope(e0b, e1b) => - e0a == e0b && e1a == e1b, - _ => false - } - } - err_out_of_scope(e0a, e1a) => { - match (*other) { - err_out_of_scope(e0b, e1b) => e0a == e0b && e1a == e1b, - _ => false - } - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &bckerr_code) -> bool { match (*self) { err_mut_uniq => { @@ -408,10 +364,6 @@ impl bckerr_code : cmp::Eq { } } } - #[cfg(stage0)] - pure fn ne(other: &bckerr_code) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &bckerr_code) -> bool { !(*self).eq(other) } } @@ -420,19 +372,9 @@ impl bckerr_code : cmp::Eq { type bckerr = {cmt: cmt, code: bckerr_code}; impl bckerr : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &bckerr) -> bool { - self.cmt == (*other).cmt && self.code == (*other).code - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &bckerr) -> bool { (*self).cmt == (*other).cmt && (*self).code == (*other).code } - #[cfg(stage0)] - pure fn ne(other: &bckerr) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &bckerr) -> bool { !(*self).eq(other) } } @@ -463,21 +405,9 @@ fn save_and_restore(save_and_restore_t: &mut T, f: fn() -> U) -> U { /// Creates and returns a new root_map impl root_map_key : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &root_map_key) -> bool { - self.id == (*other).id && self.derefs == (*other).derefs - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &root_map_key) -> bool { (*self).id == (*other).id && (*self).derefs == (*other).derefs } - #[cfg(stage0)] - pure fn ne(other: &root_map_key) -> bool { - ! (self == (*other)) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &root_map_key) -> bool { ! ((*self) == (*other)) } diff --git a/src/librustc/middle/borrowck/check_loans.rs b/src/librustc/middle/borrowck/check_loans.rs index 366dd7e7e85..66a17333444 100644 --- a/src/librustc/middle/borrowck/check_loans.rs +++ b/src/librustc/middle/borrowck/check_loans.rs @@ -33,25 +33,6 @@ enum purity_cause { } impl purity_cause : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &purity_cause) -> bool { - match self { - pc_pure_fn => { - match (*other) { - pc_pure_fn => true, - _ => false - } - } - pc_cmt(e0a) => { - match (*other) { - pc_cmt(e0b) => e0a == e0b, - _ => false - } - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &purity_cause) -> bool { match (*self) { pc_pure_fn => { @@ -68,10 +49,6 @@ impl purity_cause : cmp::Eq { } } } - #[cfg(stage0)] - pure fn ne(other: &purity_cause) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &purity_cause) -> bool { !(*self).eq(other) } } @@ -97,19 +74,9 @@ enum assignment_type { } impl assignment_type : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &assignment_type) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &assignment_type) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &assignment_type) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &assignment_type) -> bool { !(*self).eq(other) } } diff --git a/src/librustc/middle/check_alt.rs b/src/librustc/middle/check_alt.rs index 6de4e6760ed..e7716ad984e 100644 --- a/src/librustc/middle/check_alt.rs +++ b/src/librustc/middle/check_alt.rs @@ -126,22 +126,6 @@ enum ctor { } impl ctor : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &ctor) -> bool { - match (self, (*other)) { - (single, single) => true, - (variant(did_self), variant(did_other)) => did_self == did_other, - (val(cv_self), val(cv_other)) => cv_self == cv_other, - (range(cv0_self, cv1_self), range(cv0_other, cv1_other)) => { - cv0_self == cv0_other && cv1_self == cv1_other - } - (single, _) | (variant(_), _) | (val(_), _) | (range(*), _) => { - false - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &ctor) -> bool { match ((*self), (*other)) { (single, single) => true, @@ -155,10 +139,6 @@ impl ctor : cmp::Eq { } } } - #[cfg(stage0)] - pure fn ne(other: &ctor) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &ctor) -> bool { !(*self).eq(other) } } diff --git a/src/librustc/middle/const_eval.rs b/src/librustc/middle/const_eval.rs index 68e40c75da8..f2915cb27fe 100644 --- a/src/librustc/middle/const_eval.rs +++ b/src/librustc/middle/const_eval.rs @@ -206,20 +206,6 @@ enum const_val { } impl const_val : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &const_val) -> bool { - match (self, (*other)) { - (const_float(a), const_float(b)) => a == b, - (const_int(a), const_int(b)) => a == b, - (const_uint(a), const_uint(b)) => a == b, - (const_str(a), const_str(b)) => a == b, - (const_bool(a), const_bool(b)) => a == b, - (const_float(_), _) | (const_int(_), _) | (const_uint(_), _) | - (const_str(_), _) | (const_bool(_), _) => false - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &const_val) -> bool { match ((*self), (*other)) { (const_float(a), const_float(b)) => a == b, @@ -231,10 +217,6 @@ impl const_val : cmp::Eq { (const_str(_), _) | (const_bool(_), _) => false } } - #[cfg(stage0)] - pure fn ne(other: &const_val) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &const_val) -> bool { !(*self).eq(other) } } diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs index 15b9e31af1b..3691f62cc0d 100644 --- a/src/librustc/middle/lint.rs +++ b/src/librustc/middle/lint.rs @@ -68,19 +68,9 @@ enum lint { } impl lint : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &lint) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &lint) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &lint) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &lint) -> bool { !(*self).eq(other) } } @@ -98,19 +88,9 @@ enum level { } impl level : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &level) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &level) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &level) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &level) -> bool { !(*self).eq(other) } } diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index f55985aba13..0f1b7489f43 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -119,28 +119,12 @@ enum Variable = uint; enum LiveNode = uint; impl Variable : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &Variable) -> bool { *self == *(*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &Variable) -> bool { *(*self) == *(*other) } - #[cfg(stage0)] - pure fn ne(other: &Variable) -> bool { *self != *(*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &Variable) -> bool { *(*self) != *(*other) } } impl LiveNode : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &LiveNode) -> bool { *self == *(*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &LiveNode) -> bool { *(*self) == *(*other) } - #[cfg(stage0)] - pure fn ne(other: &LiveNode) -> bool { *self != *(*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &LiveNode) -> bool { *(*self) != *(*other) } } @@ -152,37 +136,6 @@ enum LiveNodeKind { } impl LiveNodeKind : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &LiveNodeKind) -> bool { - match self { - FreeVarNode(e0a) => { - match (*other) { - FreeVarNode(e0b) => e0a == e0b, - _ => false - } - } - ExprNode(e0a) => { - match (*other) { - ExprNode(e0b) => e0a == e0b, - _ => false - } - } - VarDefNode(e0a) => { - match (*other) { - VarDefNode(e0b) => e0a == e0b, - _ => false - } - } - ExitNode => { - match (*other) { - ExitNode => true, - _ => false - } - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &LiveNodeKind) -> bool { match (*self) { FreeVarNode(e0a) => { @@ -211,10 +164,6 @@ impl LiveNodeKind : cmp::Eq { } } } - #[cfg(stage0)] - pure fn ne(other: &LiveNodeKind) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &LiveNodeKind) -> bool { !(*self).eq(other) } } diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index ebc06435c64..e9fa4f6dae5 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -56,68 +56,6 @@ enum categorization { } impl categorization : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &categorization) -> bool { - match self { - cat_rvalue => { - match (*other) { - cat_rvalue => true, - _ => false - } - } - cat_special(e0a) => { - match (*other) { - cat_special(e0b) => e0a == e0b, - _ => false - } - } - cat_local(e0a) => { - match (*other) { - cat_local(e0b) => e0a == e0b, - _ => false - } - } - cat_binding(e0a) => { - match (*other) { - cat_binding(e0b) => e0a == e0b, - _ => false - } - } - cat_arg(e0a) => { - match (*other) { - cat_arg(e0b) => e0a == e0b, - _ => false - } - } - cat_stack_upvar(e0a) => { - match (*other) { - cat_stack_upvar(e0b) => e0a == e0b, - _ => false - } - } - cat_deref(e0a, e1a, e2a) => { - match (*other) { - cat_deref(e0b, e1b, e2b) => - e0a == e0b && e1a == e1b && e2a == e2b, - _ => false - } - } - cat_comp(e0a, e1a) => { - match (*other) { - cat_comp(e0b, e1b) => e0a == e0b && e1a == e1b, - _ => false - } - } - cat_discr(e0a, e1a) => { - match (*other) { - cat_discr(e0b, e1b) => e0a == e0b && e1a == e1b, - _ => false - } - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &categorization) -> bool { match (*self) { cat_rvalue => { @@ -177,10 +115,6 @@ impl categorization : cmp::Eq { } } } - #[cfg(stage0)] - pure fn ne(other: &categorization) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &categorization) -> bool { !(*self).eq(other) } } @@ -193,37 +127,6 @@ enum ptr_kind { } impl ptr_kind : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &ptr_kind) -> bool { - match self { - uniq_ptr => { - match (*other) { - uniq_ptr => true, - _ => false - } - } - gc_ptr => { - match (*other) { - gc_ptr => true, - _ => false - } - } - region_ptr(e0a) => { - match (*other) { - region_ptr(e0b) => e0a == e0b, - _ => false - } - } - unsafe_ptr => { - match (*other) { - unsafe_ptr => true, - _ => false - } - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &ptr_kind) -> bool { match (*self) { uniq_ptr => { @@ -252,10 +155,6 @@ impl ptr_kind : cmp::Eq { } } } - #[cfg(stage0)] - pure fn ne(other: &ptr_kind) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &ptr_kind) -> bool { !(*self).eq(other) } } @@ -273,43 +172,6 @@ enum comp_kind { } impl comp_kind : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &comp_kind) -> bool { - match self { - comp_tuple => { - match (*other) { - comp_tuple => true, - _ => false - } - } - comp_anon_field => { - match (*other) { - comp_anon_field => true, - _ => false - } - } - comp_variant(e0a) => { - match (*other) { - comp_variant(e0b) => e0a == e0b, - _ => false - } - } - comp_field(e0a, e1a) => { - match (*other) { - comp_field(e0b, e1b) => e0a == e0b && e1a == e1b, - _ => false - } - } - comp_index(e0a, e1a) => { - match (*other) { - comp_index(e0b, e1b) => e0a == e0b && e1a == e1b, - _ => false - } - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &comp_kind) -> bool { match (*self) { comp_tuple => { @@ -344,10 +206,6 @@ impl comp_kind : cmp::Eq { } } } - #[cfg(stage0)] - pure fn ne(other: &comp_kind) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &comp_kind) -> bool { !(*self).eq(other) } } @@ -360,19 +218,9 @@ enum special_kind { } impl special_kind : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &special_kind) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &special_kind) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &special_kind) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &special_kind) -> bool { !(*self).eq(other) } } @@ -389,17 +237,6 @@ type cmt_ = {id: ast::node_id, // id of expr/pat producing this value type cmt = @cmt_; impl cmt_ : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &cmt_) -> bool { - self.id == (*other).id && - self.span == (*other).span && - self.cat == (*other).cat && - self.lp == (*other).lp && - self.mutbl == (*other).mutbl && - self.ty == (*other).ty - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &cmt_) -> bool { (*self).id == (*other).id && (*self).span == (*other).span && @@ -408,10 +245,6 @@ impl cmt_ : cmp::Eq { (*self).mutbl == (*other).mutbl && (*self).ty == (*other).ty } - #[cfg(stage0)] - pure fn ne(other: &cmt_) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &cmt_) -> bool { !(*self).eq(other) } } @@ -426,37 +259,6 @@ enum loan_path { } impl loan_path : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &loan_path) -> bool { - match self { - lp_local(e0a) => { - match (*other) { - lp_local(e0b) => e0a == e0b, - _ => false - } - } - lp_arg(e0a) => { - match (*other) { - lp_arg(e0b) => e0a == e0b, - _ => false - } - } - lp_deref(e0a, e1a) => { - match (*other) { - lp_deref(e0b, e1b) => e0a == e0b && e1a == e1b, - _ => false - } - } - lp_comp(e0a, e1a) => { - match (*other) { - lp_comp(e0b, e1b) => e0a == e0b && e1a == e1b, - _ => false - } - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &loan_path) -> bool { match (*self) { lp_local(e0a) => { @@ -485,10 +287,6 @@ impl loan_path : cmp::Eq { } } } - #[cfg(stage0)] - pure fn ne(other: &loan_path) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &loan_path) -> bool { !(*self).eq(other) } } diff --git a/src/librustc/middle/privacy.rs b/src/librustc/middle/privacy.rs index dfdd3541169..dccb3965753 100644 --- a/src/librustc/middle/privacy.rs +++ b/src/librustc/middle/privacy.rs @@ -148,6 +148,9 @@ fn check_crate(tcx: ty::ctxt, method_map: &method_map, crate: @ast::crate) { visit::visit_mod(the_module, span, node_id, method_map, visitor); + // FIXME #4054: n_added gets corrupted without this log statement + debug!("%i", n_added); + for n_added.times { ignore(privileged_items.pop()); } diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs index e2bb63da487..e7dec95f09a 100644 --- a/src/librustc/middle/region.rs +++ b/src/librustc/middle/region.rs @@ -374,21 +374,10 @@ type region_dep = {ambient_variance: region_variance, id: ast::node_id}; type dep_map = HashMap>; impl region_dep : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: ®ion_dep) -> bool { - self.ambient_variance == (*other).ambient_variance && - self.id == (*other).id - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: ®ion_dep) -> bool { (*self).ambient_variance == (*other).ambient_variance && (*self).id == (*other).id } - #[cfg(stage0)] - pure fn ne(other: ®ion_dep) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: ®ion_dep) -> bool { !(*self).eq(other) } } diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index 828a88b5c02..581f65de25e 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -108,31 +108,6 @@ enum PatternBindingMode { } impl PatternBindingMode : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &PatternBindingMode) -> bool { - match self { - RefutableMode => { - match *other { - RefutableMode => true, - _ => false - } - } - LocalIrrefutableMode => { - match *other { - LocalIrrefutableMode => true, - _ => false - } - } - ArgumentIrrefutableMode(mode_a) => { - match *other { - ArgumentIrrefutableMode(mode_b) => mode_a == mode_b, - _ => false - } - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &PatternBindingMode) -> bool { match (*self) { RefutableMode => { @@ -155,10 +130,6 @@ impl PatternBindingMode : cmp::Eq { } } } - #[cfg(stage0)] - pure fn ne(other: &PatternBindingMode) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &PatternBindingMode) -> bool { !(*self).eq(other) } @@ -198,19 +169,9 @@ enum Mutability { } impl Mutability : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &Mutability) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &Mutability) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &Mutability) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &Mutability) -> bool { !(*self).eq(other) } } @@ -232,19 +193,9 @@ enum ImportDirectiveNS { } impl ImportDirectiveNS : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &ImportDirectiveNS) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &ImportDirectiveNS) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &ImportDirectiveNS) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &ImportDirectiveNS) -> bool { !(*self).eq(other) } @@ -343,19 +294,9 @@ enum XrayFlag { } impl XrayFlag : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &XrayFlag) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &XrayFlag) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &XrayFlag) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &XrayFlag) -> bool { !(*self).eq(other) } } @@ -365,19 +306,9 @@ enum AllowCapturingSelfFlag { } impl AllowCapturingSelfFlag : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &AllowCapturingSelfFlag) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &AllowCapturingSelfFlag) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &AllowCapturingSelfFlag) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &AllowCapturingSelfFlag) -> bool { !(*self).eq(other) } @@ -400,19 +331,9 @@ enum DuplicateCheckingMode { } impl DuplicateCheckingMode : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &DuplicateCheckingMode) -> bool { - (self as uint) == (*other as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &DuplicateCheckingMode) -> bool { ((*self) as uint) == (*other as uint) } - #[cfg(stage0)] - pure fn ne(other: &DuplicateCheckingMode) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &DuplicateCheckingMode) -> bool { !(*self).eq(other) } @@ -619,19 +540,9 @@ enum Privacy { } impl Privacy : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &Privacy) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &Privacy) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &Privacy) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &Privacy) -> bool { !(*self).eq(other) } } diff --git a/src/librustc/middle/trans/alt.rs b/src/librustc/middle/trans/alt.rs index 49db8613366..c8753dd0274 100644 --- a/src/librustc/middle/trans/alt.rs +++ b/src/librustc/middle/trans/alt.rs @@ -907,19 +907,9 @@ fn pick_col(m: &[@Match]) -> uint { enum branch_kind { no_branch, single, switch, compare, } impl branch_kind : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &branch_kind) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &branch_kind) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &branch_kind) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &branch_kind) -> bool { !(*self).eq(other) } } diff --git a/src/librustc/middle/trans/common.rs b/src/librustc/middle/trans/common.rs index 1000aec9d18..8ce3b4153f0 100644 --- a/src/librustc/middle/trans/common.rs +++ b/src/librustc/middle/trans/common.rs @@ -296,25 +296,6 @@ enum cleanup { } impl cleantype : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &cleantype) -> bool { - match self { - normal_exit_only => { - match (*other) { - normal_exit_only => true, - _ => false - } - } - normal_exit_and_unwind => { - match (*other) { - normal_exit_and_unwind => true, - _ => false - } - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &cleantype) -> bool { match (*self) { normal_exit_only => { @@ -331,10 +312,6 @@ impl cleantype : cmp::Eq { } } } - #[cfg(stage0)] - pure fn ne(other: &cleantype) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &cleantype) -> bool { !(*self).eq(other) } } @@ -1167,25 +1144,6 @@ type mono_id_ = { type mono_id = @mono_id_; impl mono_param_id : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &mono_param_id) -> bool { - match (self, (*other)) { - (mono_precise(ty_a, ids_a), mono_precise(ty_b, ids_b)) => { - ty_a == ty_b && ids_a == ids_b - } - (mono_any, mono_any) => true, - (mono_repr(size_a, align_a, is_float_a, mode_a), - mono_repr(size_b, align_b, is_float_b, mode_b)) => { - size_a == size_b && align_a == align_b && - is_float_a == is_float_b && mode_a == mode_b - } - (mono_precise(*), _) => false, - (mono_any, _) => false, - (mono_repr(*), _) => false - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &mono_param_id) -> bool { match ((*self), (*other)) { (mono_precise(ty_a, ids_a), mono_precise(ty_b, ids_b)) => { @@ -1202,27 +1160,13 @@ impl mono_param_id : cmp::Eq { (mono_repr(*), _) => false } } - #[cfg(stage0)] - pure fn ne(other: &mono_param_id) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &mono_param_id) -> bool { !(*self).eq(other) } } impl mono_id_ : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &mono_id_) -> bool { - self.def == (*other).def && self.params == (*other).params - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &mono_id_) -> bool { (*self).def == (*other).def && (*self).params == (*other).params } - #[cfg(stage0)] - pure fn ne(other: &mono_id_) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &mono_id_) -> bool { !(*self).eq(other) } } diff --git a/src/librustc/middle/trans/datum.rs b/src/librustc/middle/trans/datum.rs index 126ab65053e..0246e617e25 100644 --- a/src/librustc/middle/trans/datum.rs +++ b/src/librustc/middle/trans/datum.rs @@ -139,19 +139,9 @@ impl DatumMode { } impl DatumMode: cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &DatumMode) -> bool { - self as uint == (*other as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &DatumMode) -> bool { (*self) as uint == (*other as uint) } - #[cfg(stage0)] - pure fn ne(other: &DatumMode) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &DatumMode) -> bool { !(*self).eq(other) } } @@ -809,17 +799,6 @@ impl DatumBlock { } impl CopyAction : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &CopyAction) -> bool { - match (self, (*other)) { - (INIT, INIT) => true, - (DROP_EXISTING, DROP_EXISTING) => true, - (INIT, _) => false, - (DROP_EXISTING, _) => false, - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &CopyAction) -> bool { match ((*self), (*other)) { (INIT, INIT) => true, @@ -828,9 +807,5 @@ impl CopyAction : cmp::Eq { (DROP_EXISTING, _) => false, } } - #[cfg(stage0)] - pure fn ne(other: &CopyAction) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &CopyAction) -> bool { !(*self).eq(other) } } diff --git a/src/librustc/middle/trans/expr.rs b/src/librustc/middle/trans/expr.rs index c6b5b9fbfe0..0b8cef3da37 100644 --- a/src/librustc/middle/trans/expr.rs +++ b/src/librustc/middle/trans/expr.rs @@ -148,17 +148,6 @@ impl Dest { } impl Dest : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &Dest) -> bool { - match (self, (*other)) { - (SaveIn(e0a), SaveIn(e0b)) => e0a == e0b, - (Ignore, Ignore) => true, - (SaveIn(*), _) => false, - (Ignore, _) => false, - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &Dest) -> bool { match ((*self), (*other)) { (SaveIn(e0a), SaveIn(e0b)) => e0a == e0b, @@ -167,10 +156,6 @@ impl Dest : cmp::Eq { (Ignore, _) => false, } } - #[cfg(stage0)] - pure fn ne(other: &Dest) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &Dest) -> bool { !(*self).eq(other) } } @@ -1444,23 +1429,6 @@ enum cast_kind { } impl cast_kind : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &cast_kind) -> bool { - match (self, (*other)) { - (cast_pointer, cast_pointer) => true, - (cast_integral, cast_integral) => true, - (cast_float, cast_float) => true, - (cast_enum, cast_enum) => true, - (cast_other, cast_other) => true, - (cast_pointer, _) => false, - (cast_integral, _) => false, - (cast_float, _) => false, - (cast_enum, _) => false, - (cast_other, _) => false, - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &cast_kind) -> bool { match ((*self), (*other)) { (cast_pointer, cast_pointer) => true, @@ -1475,10 +1443,6 @@ impl cast_kind : cmp::Eq { (cast_other, _) => false, } } - #[cfg(stage0)] - pure fn ne(other: &cast_kind) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &cast_kind) -> bool { !(*self).eq(other) } } diff --git a/src/librustc/middle/trans/foreign.rs b/src/librustc/middle/trans/foreign.rs index cac60a4abe2..4fe7c307d59 100644 --- a/src/librustc/middle/trans/foreign.rs +++ b/src/librustc/middle/trans/foreign.rs @@ -41,19 +41,9 @@ enum x86_64_reg_class { } impl x86_64_reg_class : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &x86_64_reg_class) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &x86_64_reg_class) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &x86_64_reg_class) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &x86_64_reg_class) -> bool { !(*self).eq(other) } } diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 864619f2759..7cb49b88c67 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -245,25 +245,11 @@ type creader_cache_key = {cnum: int, pos: uint, len: uint}; type creader_cache = HashMap; impl creader_cache_key : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &creader_cache_key) -> bool { - self.cnum == (*other).cnum && - self.pos == (*other).pos && - self.len == (*other).len - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &creader_cache_key) -> bool { (*self).cnum == (*other).cnum && (*self).pos == (*other).pos && (*self).len == (*other).len } - #[cfg(stage0)] - pure fn ne(other: &creader_cache_key) -> bool { - !(self == (*other)) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &creader_cache_key) -> bool { !((*self) == (*other)) } @@ -278,19 +264,9 @@ impl creader_cache_key : to_bytes::IterBytes { type intern_key = {sty: sty, o_def_id: Option}; impl intern_key : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &intern_key) -> bool { - self.sty == (*other).sty && self.o_def_id == (*other).o_def_id - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &intern_key) -> bool { (*self).sty == (*other).sty && (*self).o_def_id == (*other).o_def_id } - #[cfg(stage0)] - pure fn ne(other: &intern_key) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &intern_key) -> bool { !(*self).eq(other) } } @@ -312,19 +288,6 @@ type opt_region_variance = Option; enum region_variance { rv_covariant, rv_invariant, rv_contravariant } impl region_variance : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: ®ion_variance) -> bool { - match (self, (*other)) { - (rv_covariant, rv_covariant) => true, - (rv_invariant, rv_invariant) => true, - (rv_contravariant, rv_contravariant) => true, - (rv_covariant, _) => false, - (rv_invariant, _) => false, - (rv_contravariant, _) => false - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: ®ion_variance) -> bool { match ((*self), (*other)) { (rv_covariant, rv_covariant) => true, @@ -335,10 +298,6 @@ impl region_variance : cmp::Eq { (rv_contravariant, _) => false } } - #[cfg(stage0)] - pure fn ne(other: ®ion_variance) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: ®ion_variance) -> bool { !(*self).eq(other) } } @@ -547,19 +506,9 @@ type FnTy = FnTyBase; type param_ty = {idx: uint, def_id: def_id}; impl param_ty : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: ¶m_ty) -> bool { - self.idx == (*other).idx && self.def_id == (*other).def_id - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: ¶m_ty) -> bool { (*self).idx == (*other).idx && (*self).def_id == (*other).def_id } - #[cfg(stage0)] - pure fn ne(other: ¶m_ty) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: ¶m_ty) -> bool { !(*self).eq(other) } } @@ -776,20 +725,6 @@ impl InferRegion : to_bytes::IterBytes { } impl InferRegion : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &InferRegion) -> bool { - match (self, *other) { - (ReVar(rva), ReVar(rvb)) => { - rva == rvb - } - (ReSkolemized(rva, _), ReSkolemized(rvb, _)) => { - rva == rvb - } - _ => false - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &InferRegion) -> bool { match ((*self), *other) { (ReVar(rva), ReVar(rvb)) => { @@ -801,12 +736,6 @@ impl InferRegion : cmp::Eq { _ => false } } - #[cfg(stage0)] - pure fn ne(other: &InferRegion) -> bool { - !(self == (*other)) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &InferRegion) -> bool { !((*self) == (*other)) } @@ -4278,88 +4207,27 @@ pure fn determine_inherited_purity(parent_purity: ast::purity, } impl mt : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &mt) -> bool { - self.ty == (*other).ty && self.mutbl == (*other).mutbl - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &mt) -> bool { (*self).ty == (*other).ty && (*self).mutbl == (*other).mutbl } - #[cfg(stage0)] - pure fn ne(other: &mt) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &mt) -> bool { !(*self).eq(other) } } impl arg : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &arg) -> bool { - self.mode == (*other).mode && self.ty == (*other).ty - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &arg) -> bool { (*self).mode == (*other).mode && (*self).ty == (*other).ty } - #[cfg(stage0)] - pure fn ne(other: &arg) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &arg) -> bool { !(*self).eq(other) } } impl field : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &field) -> bool { - self.ident == (*other).ident && self.mt == (*other).mt - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &field) -> bool { (*self).ident == (*other).ident && (*self).mt == (*other).mt } - #[cfg(stage0)] - pure fn ne(other: &field) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &field) -> bool { !(*self).eq(other) } } impl vstore : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &vstore) -> bool { - match self { - vstore_fixed(e0a) => { - match (*other) { - vstore_fixed(e0b) => e0a == e0b, - _ => false - } - } - vstore_uniq => { - match (*other) { - vstore_uniq => true, - _ => false - } - } - vstore_box => { - match (*other) { - vstore_box => true, - _ => false - } - } - vstore_slice(e0a) => { - match (*other) { - vstore_slice(e0b) => e0a == e0b, - _ => false - } - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &vstore) -> bool { match (*self) { vstore_fixed(e0a) => { @@ -4388,175 +4256,60 @@ impl vstore : cmp::Eq { } } } - #[cfg(stage0)] - pure fn ne(other: &vstore) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &vstore) -> bool { !(*self).eq(other) } } impl FnMeta : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &FnMeta) -> bool { - self.purity == (*other).purity && - self.proto == (*other).proto && - self.bounds == (*other).bounds && - self.ret_style == (*other).ret_style - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &FnMeta) -> bool { (*self).purity == (*other).purity && (*self).proto == (*other).proto && (*self).bounds == (*other).bounds && (*self).ret_style == (*other).ret_style } - #[cfg(stage0)] - pure fn ne(other: &FnMeta) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &FnMeta) -> bool { !(*self).eq(other) } } impl FnSig : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &FnSig) -> bool { - self.inputs == (*other).inputs && - self.output == (*other).output - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &FnSig) -> bool { (*self).inputs == (*other).inputs && (*self).output == (*other).output } - #[cfg(stage0)] - pure fn ne(other: &FnSig) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &FnSig) -> bool { !(*self).eq(other) } } impl FnTyBase : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &FnTyBase) -> bool { - self.meta == (*other).meta && self.sig == (*other).sig - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &FnTyBase) -> bool { (*self).meta == (*other).meta && (*self).sig == (*other).sig } - #[cfg(stage0)] - pure fn ne(other: &FnTyBase) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &FnTyBase) -> bool { !(*self).eq(other) } } impl TyVid : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &TyVid) -> bool { *self == *(*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &TyVid) -> bool { *(*self) == *(*other) } - #[cfg(stage0)] - pure fn ne(other: &TyVid) -> bool { *self != *(*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &TyVid) -> bool { *(*self) != *(*other) } } impl IntVid : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &IntVid) -> bool { *self == *(*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &IntVid) -> bool { *(*self) == *(*other) } - #[cfg(stage0)] - pure fn ne(other: &IntVid) -> bool { *self != *(*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &IntVid) -> bool { *(*self) != *(*other) } } impl FloatVid : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &FloatVid) -> bool { *self == *(*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &FloatVid) -> bool { *(*self) == *(*other) } - #[cfg(stage0)] - pure fn ne(other: &FloatVid) -> bool { *self != *(*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &FloatVid) -> bool { *(*self) != *(*other) } } impl FnVid : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &FnVid) -> bool { *self == *(*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &FnVid) -> bool { *(*self) == *(*other) } - #[cfg(stage0)] - pure fn ne(other: &FnVid) -> bool { *self != *(*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &FnVid) -> bool { *(*self) != *(*other) } } impl RegionVid : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &RegionVid) -> bool { *self == *(*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &RegionVid) -> bool { *(*self) == *(*other) } - #[cfg(stage0)] - pure fn ne(other: &RegionVid) -> bool { *self != *(*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &RegionVid) -> bool { *(*self) != *(*other) } } impl Region : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &Region) -> bool { - match self { - re_bound(e0a) => { - match (*other) { - re_bound(e0b) => e0a == e0b, - _ => false - } - } - re_free(e0a, e1a) => { - match (*other) { - re_free(e0b, e1b) => e0a == e0b && e1a == e1b, - _ => false - } - } - re_scope(e0a) => { - match (*other) { - re_scope(e0b) => e0a == e0b, - _ => false - } - } - re_static => { - match (*other) { - re_static => true, - _ => false - } - } - re_infer(e0a) => { - match (*other) { - re_infer(e0b) => e0a == e0b, - _ => false - } - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &Region) -> bool { match (*self) { re_bound(e0a) => { @@ -4591,45 +4344,10 @@ impl Region : cmp::Eq { } } } - #[cfg(stage0)] - pure fn ne(other: &Region) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &Region) -> bool { !(*self).eq(other) } } impl bound_region : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &bound_region) -> bool { - match self { - br_self => { - match (*other) { - br_self => true, - _ => false - } - } - br_anon(e0a) => { - match (*other) { - br_anon(e0b) => e0a == e0b, - _ => false - } - } - br_named(e0a) => { - match (*other) { - br_named(e0b) => e0a == e0b, - _ => false - } - } - br_cap_avoid(e0a, e1a) => { - match (*other) { - br_cap_avoid(e0b, e1b) => e0a == e0b && e1a == e1b, - _ => false - } - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &bound_region) -> bool { match (*self) { br_self => { @@ -4658,216 +4376,26 @@ impl bound_region : cmp::Eq { } } } - #[cfg(stage0)] - pure fn ne(other: &bound_region) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &bound_region) -> bool { !(*self).eq(other) } } impl substs : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &substs) -> bool { - self.self_r == (*other).self_r && - self.self_ty == (*other).self_ty && - self.tps == (*other).tps - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &substs) -> bool { (*self).self_r == (*other).self_r && (*self).self_ty == (*other).self_ty && (*self).tps == (*other).tps } - #[cfg(stage0)] - pure fn ne(other: &substs) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &substs) -> bool { !(*self).eq(other) } } impl InferTy : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &InferTy) -> bool { - self.to_hash() == (*other).to_hash() - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &InferTy) -> bool { (*self).to_hash() == (*other).to_hash() } - #[cfg(stage0)] - pure fn ne(other: &InferTy) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &InferTy) -> bool { !(*self).eq(other) } } impl sty : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &sty) -> bool { - match self { - ty_nil => { - match (*other) { - ty_nil => true, - _ => false - } - } - ty_bot => { - match (*other) { - ty_bot => true, - _ => false - } - } - ty_bool => { - match (*other) { - ty_bool => true, - _ => false - } - } - ty_int(e0a) => { - match (*other) { - ty_int(e0b) => e0a == e0b, - _ => false - } - } - ty_uint(e0a) => { - match (*other) { - ty_uint(e0b) => e0a == e0b, - _ => false - } - } - ty_float(e0a) => { - match (*other) { - ty_float(e0b) => e0a == e0b, - _ => false - } - } - ty_estr(e0a) => { - match (*other) { - ty_estr(e0b) => e0a == e0b, - _ => false - } - } - ty_enum(e0a, e1a) => { - match (*other) { - ty_enum(e0b, e1b) => e0a == e0b && e1a == e1b, - _ => false - } - } - ty_box(e0a) => { - match (*other) { - ty_box(e0b) => e0a == e0b, - _ => false - } - } - ty_uniq(e0a) => { - match (*other) { - ty_uniq(e0b) => e0a == e0b, - _ => false - } - } - ty_evec(e0a, e1a) => { - match (*other) { - ty_evec(e0b, e1b) => e0a == e0b && e1a == e1b, - _ => false - } - } - ty_ptr(e0a) => { - match (*other) { - ty_ptr(e0b) => e0a == e0b, - _ => false - } - } - ty_rptr(e0a, e1a) => { - match (*other) { - ty_rptr(e0b, e1b) => e0a == e0b && e1a == e1b, - _ => false - } - } - ty_rec(e0a) => { - match (*other) { - ty_rec(e0b) => e0a == e0b, - _ => false - } - } - ty_fn(e0a) => { - match (*other) { - ty_fn(e0b) => e0a == e0b, - _ => false - } - } - ty_trait(e0a, e1a, e2a) => { - match (*other) { - ty_trait(e0b, e1b, e2b) => - e0a == e0b && e1a == e1b && e2a == e2b, - _ => false - } - } - ty_class(e0a, e1a) => { - match (*other) { - ty_class(e0b, e1b) => e0a == e0b && e1a == e1b, - _ => false - } - } - ty_tup(e0a) => { - match (*other) { - ty_tup(e0b) => e0a == e0b, - _ => false - } - } - ty_infer(e0a) => { - match (*other) { - ty_infer(e0b) => e0a == e0b, - _ => false - } - } - ty_err => { - match (*other) { - ty_err => true, - _ => false - } - } - ty_param(e0a) => { - match (*other) { - ty_param(e0b) => e0a == e0b, - _ => false - } - } - ty_self => { - match (*other) { - ty_self => true, - _ => false - } - } - ty_type => { - match (*other) { - ty_type => true, - _ => false - } - } - ty_opaque_box => { - match (*other) { - ty_opaque_box => true, - _ => false - } - } - ty_opaque_closure_ptr(e0a) => { - match (*other) { - ty_opaque_closure_ptr(e0b) => e0a == e0b, - _ => false - } - } - ty_unboxed_vec(e0a) => { - match (*other) { - ty_unboxed_vec(e0b) => e0a == e0b, - _ => false - } - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &sty) -> bool { match (*self) { ty_nil => { @@ -5029,51 +4557,10 @@ impl sty : cmp::Eq { } } } - #[cfg(stage0)] - pure fn ne(other: &sty) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &sty) -> bool { !(*self).eq(other) } } impl param_bound : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: ¶m_bound) -> bool { - match self { - bound_copy => { - match (*other) { - bound_copy => true, - _ => false - } - } - bound_owned => { - match (*other) { - bound_owned => true, - _ => false - } - } - bound_send => { - match (*other) { - bound_send => true, - _ => false - } - } - bound_const => { - match (*other) { - bound_const => true, - _ => false - } - } - bound_trait(e0a) => { - match (*other) { - bound_trait(e0b) => e0a == e0b, - _ => false - } - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: ¶m_bound) -> bool { match (*self) { bound_copy => { @@ -5108,23 +4595,11 @@ impl param_bound : cmp::Eq { } } } - #[cfg(stage0)] - pure fn ne(other: ¶m_bound) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] - pure fn ne(&self, other: ¶m_bound) -> bool { !(*self).eq(other) } + pure fn ne(&self, other: ¶m_bound) -> bool { !self.eq(other) } } impl Kind : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &Kind) -> bool { *self == *(*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &Kind) -> bool { *(*self) == *(*other) } - #[cfg(stage0)] - pure fn ne(other: &Kind) -> bool { *self != *(*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &Kind) -> bool { *(*self) != *(*other) } } diff --git a/src/librustc/middle/typeck/infer/region_inference.rs b/src/librustc/middle/typeck/infer/region_inference.rs index 923e29cf863..7f5d503dac9 100644 --- a/src/librustc/middle/typeck/infer/region_inference.rs +++ b/src/librustc/middle/typeck/infer/region_inference.rs @@ -469,25 +469,6 @@ enum Constraint { } impl Constraint : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &Constraint) -> bool { - match (self, (*other)) { - (ConstrainVarSubVar(v0a, v1a), ConstrainVarSubVar(v0b, v1b)) => { - v0a == v0b && v1a == v1b - } - (ConstrainRegSubVar(ra, va), ConstrainRegSubVar(rb, vb)) => { - ra == rb && va == vb - } - (ConstrainVarSubReg(va, ra), ConstrainVarSubReg(vb, rb)) => { - va == vb && ra == rb - } - (ConstrainVarSubVar(*), _) => false, - (ConstrainRegSubVar(*), _) => false, - (ConstrainVarSubReg(*), _) => false - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &Constraint) -> bool { match ((*self), (*other)) { (ConstrainVarSubVar(v0a, v1a), ConstrainVarSubVar(v0b, v1b)) => { @@ -504,10 +485,6 @@ impl Constraint : cmp::Eq { (ConstrainVarSubReg(*), _) => false } } - #[cfg(stage0)] - pure fn ne(other: &Constraint) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &Constraint) -> bool { !(*self).eq(other) } } @@ -532,19 +509,9 @@ struct TwoRegions { } impl TwoRegions : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &TwoRegions) -> bool { - self.a == (*other).a && self.b == (*other).b - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &TwoRegions) -> bool { (*self).a == (*other).a && (*self).b == (*other).b } - #[cfg(stage0)] - pure fn ne(other: &TwoRegions) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &TwoRegions) -> bool { !(*self).eq(other) } } @@ -1068,38 +1035,18 @@ priv impl RegionVarBindings { enum Direction { Incoming = 0, Outgoing = 1 } impl Direction : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &Direction) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &Direction) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &Direction) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &Direction) -> bool { !(*self).eq(other) } } enum Classification { Expanding, Contracting } impl Classification : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &Classification) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &Classification) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &Classification) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &Classification) -> bool { !(*self).eq(other) } } diff --git a/src/librustc/rustc.rc b/src/librustc/rustc.rc index 25bf8ab1027..ac222aa1fa8 100644 --- a/src/librustc/rustc.rc +++ b/src/librustc/rustc.rc @@ -1,5 +1,3 @@ -// DIVERT - // -*- rust -*- #[link(name = "rustc", @@ -45,246 +43,446 @@ mod middle { mod trans { #[legacy_exports]; #[legacy_exports] + #[path = "middle/trans/inline.rs"] mod inline; #[legacy_exports] + #[path = "middle/trans/monomorphize.rs"] mod monomorphize; #[legacy_exports] + #[path = "middle/trans/controlflow.rs"] mod controlflow; #[legacy_exports] + #[path = "middle/trans/glue.rs"] mod glue; #[legacy_exports] + #[path = "middle/trans/datum.rs"] mod datum; #[legacy_exports] + #[path = "middle/trans/callee.rs"] mod callee; #[legacy_exports] + #[path = "middle/trans/expr.rs"] mod expr; #[legacy_exports] + #[path = "middle/trans/common.rs"] mod common; #[legacy_exports] + #[path = "middle/trans/consts.rs"] mod consts; #[legacy_exports] + #[path = "middle/trans/type_of.rs"] mod type_of; #[legacy_exports] + #[path = "middle/trans/build.rs"] mod build; #[legacy_exports] + #[path = "middle/trans/base.rs"] mod base; #[legacy_exports] + #[path = "middle/trans/alt.rs"] mod alt; #[legacy_exports] + #[path = "middle/trans/uniq.rs"] mod uniq; #[legacy_exports] + #[path = "middle/trans/closure.rs"] mod closure; #[legacy_exports] + #[path = "middle/trans/tvec.rs"] mod tvec; #[legacy_exports] + #[path = "middle/trans/meth.rs"] mod meth; #[legacy_exports] + #[path = "middle/trans/foreign.rs"] mod foreign; #[legacy_exports] + #[path = "middle/trans/reflect.rs"] mod reflect; #[legacy_exports] + #[path = "middle/trans/shape.rs"] mod shape; #[legacy_exports] + #[path = "middle/trans/debuginfo.rs"] mod debuginfo; #[legacy_exports] + #[path = "middle/trans/type_use.rs"] mod type_use; #[legacy_exports] + #[path = "middle/trans/reachable.rs"] mod reachable; + #[path = "middle/trans/machine.rs"] mod machine; + #[path = "middle/trans/deriving.rs"] mod deriving; } #[legacy_exports] + #[path = "middle/ty.rs"] mod ty; #[legacy_exports] + #[path = "middle/resolve.rs"] mod resolve; - pub mod typeck { - #[legacy_exports]; - #[legacy_exports] - pub mod check { - #[legacy_exports] - mod alt; - #[legacy_exports] - mod vtable; - #[legacy_exports] - mod writeback; - #[legacy_exports] - mod regionmanip; - #[legacy_exports] - mod regionck; - #[legacy_exports] - mod demand; - #[legacy_exports] - pub mod method; - } - #[legacy_exports] - mod rscope; - #[legacy_exports] - mod astconv; - mod infer { - #[legacy_exports]; - #[legacy_exports] - mod assignment; - #[legacy_exports] - mod combine; - #[legacy_exports] - mod glb; - #[legacy_exports] - mod integral; - mod floating; - #[legacy_exports] - mod lattice; - #[legacy_exports] - mod lub; - #[legacy_exports] - mod region_inference; - #[legacy_exports] - mod resolve; - #[legacy_exports] - mod sub; - #[legacy_exports] - mod to_str; - #[legacy_exports] - mod unify; - #[cfg(test)] - #[legacy_exports] - mod test; - } - #[legacy_exports] - mod collect; - #[legacy_exports] - mod coherence; - mod deriving; - } + #[path = "middle/typeck.rs"] + #[merge = "middle/typeck/mod.rs"] + pub mod typeck; #[legacy_exports] + #[path = "middle/check_loop.rs"] mod check_loop; #[legacy_exports] + #[path = "middle/check_alt.rs"] mod check_alt; #[legacy_exports] + #[path = "middle/check_const.rs"] mod check_const; #[legacy_exports] + #[path = "middle/lint.rs"] mod lint; - mod borrowck { - #[legacy_exports]; - #[legacy_exports] - mod check_loans; - #[legacy_exports] - mod gather_loans; - #[legacy_exports] - mod loan; - #[legacy_exports] - mod preserve; - } + #[path = "middle/borrowck.rs"] + #[merge = "middle/borrowck/mod.rs"] + mod borrowck; #[legacy_exports] + #[path = "middle/mem_categorization.rs"] mod mem_categorization; #[legacy_exports] + #[path = "middle/liveness.rs"] mod liveness; #[legacy_exports] + #[path = "middle/kind.rs"] mod kind; #[legacy_exports] + #[path = "middle/freevars.rs"] mod freevars; #[legacy_exports] + #[path = "middle/capture.rs"] mod capture; #[legacy_exports] + #[path = "middle/pat_util.rs"] mod pat_util; #[legacy_exports] + #[path = "middle/region.rs"] mod region; #[legacy_exports] + #[path = "middle/const_eval.rs"] mod const_eval; #[legacy_exports] + #[path = "middle/astencode.rs"] mod astencode; #[legacy_exports] + #[path = "middle/lang_items.rs"] mod lang_items; #[legacy_exports] + #[path = "middle/privacy.rs"] mod privacy; } mod front { #[legacy_exports]; #[legacy_exports] + #[path = "front/config.rs"] mod config; #[legacy_exports] + #[path = "front/test.rs"] mod test; #[legacy_exports] + #[path = "front/core_inject.rs"] mod core_inject; #[legacy_exports] + #[path = "front/intrinsic_inject.rs"] mod intrinsic_inject; } mod back { #[legacy_exports]; #[legacy_exports] + #[path = "back/link.rs"] mod link; #[legacy_exports] + #[path = "back/abi.rs"] mod abi; #[legacy_exports] + #[path = "back/upcall.rs"] mod upcall; #[legacy_exports] + #[path = "back/x86.rs"] mod x86; #[legacy_exports] + #[path = "back/x86_64.rs"] mod x86_64; #[legacy_exports] + #[path = "back/rpath.rs"] mod rpath; #[legacy_exports] + #[path = "back/target_strs.rs"] mod target_strs; } -mod metadata { - #[legacy_exports]; - export encoder; - export creader; - export cstore; - export csearch; - export common; - export decoder; - export tyencode; - export tydecode; - export loader; - export filesearch; +#[merge = "metadata/mod.rs"] +mod metadata; - #[legacy_exports] - mod common; - #[legacy_exports] - mod tyencode; - #[legacy_exports] - mod tydecode; - #[legacy_exports] - mod encoder; - #[legacy_exports] - mod decoder; - #[legacy_exports] - mod creader; - #[legacy_exports] - mod cstore; - #[legacy_exports] - mod csearch; - #[legacy_exports] - mod loader; - #[legacy_exports] - mod filesearch; -} - -mod driver { - #[legacy_exports]; - #[legacy_exports] - mod driver; - #[legacy_exports] - mod session; -} +#[merge = "driver/mod.rs"] +mod driver; mod util { #[legacy_exports]; #[legacy_exports] + #[path = "util/common.rs"] mod common; #[legacy_exports] + #[path = "util/ppaux.rs"] mod ppaux; } mod lib { #[legacy_exports]; #[legacy_exports] + #[path = "lib/llvm.rs"] mod llvm; } +use result::{Ok, Err}; +use io::ReaderUtil; +use std::getopts; +use std::map::HashMap; +use getopts::{opt_present}; +use getopts::groups; +use syntax::codemap; +use syntax::diagnostic; +use driver::driver::{host_triple, optgroups, early_error, + str_input, file_input, build_session_options, + build_session, build_configuration, parse_pretty, + pp_mode, pretty_print_input, list_metadata, + compile_input}; +use driver::session; +use middle::lint; + +fn version(argv0: &str) { + let mut vers = ~"unknown version"; + let env_vers = env!("CFG_VERSION"); + if env_vers.len() != 0 { vers = env_vers; } + io::println(fmt!("%s %s", argv0, vers)); + io::println(fmt!("host: %s", host_triple())); +} + +fn usage(argv0: &str) { + let message = fmt!("Usage: %s [OPTIONS] INPUT", argv0); + io::println(groups::usage(message, optgroups()) + + ~"Additional help: + -W help Print 'lint' options and default settings + -Z help Print internal options for debugging rustc +"); +} + +fn describe_warnings() { + io::println(fmt!(" +Available lint options: + -W Warn about + -A Allow + -D Deny + -F Forbid (deny, and deny all overrides) +")); + + let lint_dict = lint::get_lint_dict(); + let mut max_key = 0; + for lint_dict.each_key |k| { max_key = uint::max(k.len(), max_key); } + fn padded(max: uint, s: &str) -> ~str { + str::from_bytes(vec::from_elem(max - s.len(), ' ' as u8)) + s + } + io::println(fmt!("\nAvailable lint checks:\n")); + io::println(fmt!(" %s %7.7s %s", + padded(max_key, ~"name"), ~"default", ~"meaning")); + io::println(fmt!(" %s %7.7s %s\n", + padded(max_key, ~"----"), ~"-------", ~"-------")); + for lint_dict.each |k, v| { + let k = str::replace(k, ~"_", ~"-"); + io::println(fmt!(" %s %7.7s %s", + padded(max_key, k), + match v.default { + lint::allow => ~"allow", + lint::warn => ~"warn", + lint::deny => ~"deny", + lint::forbid => ~"forbid" + }, + v.desc)); + } + io::println(~""); +} + +fn describe_debug_flags() { + io::println(fmt!("\nAvailable debug options:\n")); + for session::debugging_opts_map().each |pair| { + let (name, desc, _) = *pair; + io::println(fmt!(" -Z %-20s -- %s", name, desc)); + } +} + +fn run_compiler(args: &~[~str], demitter: diagnostic::emitter) { + // Don't display log spew by default. Can override with RUST_LOG. + logging::console_off(); + + let mut args = *args; + let binary = args.shift(); + + if args.is_empty() { usage(binary); return; } + + let matches = + match getopts::groups::getopts(args, optgroups()) { + Ok(m) => m, + Err(f) => { + early_error(demitter, getopts::fail_str(f)) + } + }; + + if opt_present(matches, ~"h") || opt_present(matches, ~"help") { + usage(binary); + return; + } + + let lint_flags = vec::append(getopts::opt_strs(matches, ~"W"), + getopts::opt_strs(matches, ~"warn")); + if lint_flags.contains(&~"help") { + describe_warnings(); + return; + } + + if getopts::opt_strs(matches, ~"Z").contains(&~"help") { + describe_debug_flags(); + return; + } + + if opt_present(matches, ~"v") || opt_present(matches, ~"version") { + version(binary); + return; + } + let input = match vec::len(matches.free) { + 0u => early_error(demitter, ~"no input filename given"), + 1u => { + let ifile = matches.free[0]; + if ifile == ~"-" { + let src = str::from_bytes(io::stdin().read_whole_stream()); + str_input(src) + } else { + file_input(Path(ifile)) + } + } + _ => early_error(demitter, ~"multiple input filenames provided") + }; + + let sopts = build_session_options(binary, matches, demitter); + let sess = build_session(sopts, demitter); + let odir = getopts::opt_maybe_str(matches, ~"out-dir"); + let odir = odir.map(|o| Path(*o)); + let ofile = getopts::opt_maybe_str(matches, ~"o"); + let ofile = ofile.map(|o| Path(*o)); + let cfg = build_configuration(sess, binary, input); + let pretty = + option::map(&getopts::opt_default(matches, ~"pretty", + ~"normal"), + |a| parse_pretty(sess, *a) ); + match pretty { + Some::(ppm) => { + pretty_print_input(sess, cfg, input, ppm); + return; + } + None:: => {/* continue */ } + } + let ls = opt_present(matches, ~"ls"); + if ls { + match input { + file_input(ifile) => { + list_metadata(sess, &ifile, io::stdout()); + } + str_input(_) => { + early_error(demitter, ~"can not list metadata for stdin"); + } + } + return; + } + + compile_input(sess, cfg, input, &odir, &ofile); +} + +enum monitor_msg { + fatal, + done, +} + +impl monitor_msg : cmp::Eq { + pure fn eq(&self, other: &monitor_msg) -> bool { + ((*self) as uint) == ((*other) as uint) + } + pure fn ne(&self, other: &monitor_msg) -> bool { !(*self).eq(other) } +} + +/* +This is a sanity check that any failure of the compiler is performed +through the diagnostic module and reported properly - we shouldn't be calling +plain-old-fail on any execution path that might be taken. Since we have +console logging off by default, hitting a plain fail statement would make the +compiler silently exit, which would be terrible. + +This method wraps the compiler in a subtask and injects a function into the +diagnostic emitter which records when we hit a fatal error. If the task +fails without recording a fatal error then we've encountered a compiler +bug and need to present an error. +*/ +fn monitor(+f: fn~(diagnostic::emitter)) { + let p = comm::Port(); + let ch = comm::Chan(&p); + + match do task::try |move f| { + + // The 'diagnostics emitter'. Every error, warning, etc. should + // go through this function. + let demitter = fn@(cmsp: Option<(@codemap::CodeMap, codemap::span)>, + msg: &str, lvl: diagnostic::level) { + if lvl == diagnostic::fatal { + comm::send(ch, fatal); + } + diagnostic::emit(cmsp, msg, lvl); + }; + + struct finally { + ch: comm::Chan, + drop { comm::send(self.ch, done); } + } + + let _finally = finally { ch: ch }; + + f(demitter) + } { + result::Ok(_) => { /* fallthrough */ } + result::Err(_) => { + // Task failed without emitting a fatal diagnostic + if comm::recv(p) == done { + diagnostic::emit( + None, + diagnostic::ice_msg(~"unexpected failure"), + diagnostic::error); + + for [ + ~"the compiler hit an unexpected failure path. \ + this is a bug", + ~"try running with RUST_LOG=rustc=1,::rt::backtrace \ + to get further details and report the results \ + to github.com/mozilla/rust/issues" + ].each |note| { + diagnostic::emit(None, *note, diagnostic::note) + } + } + // Fail so the process returns a failure code + fail; + } + } +} + +fn main() { + let mut args = os::args(); + do monitor |move args, demitter| { + run_compiler(&args, demitter); + } +} + + // Local Variables: // fill-column: 78; // indent-tabs-mode: nil diff --git a/src/librustc/rustc.rs b/src/librustc/rustc.rs deleted file mode 100644 index c03464e3358..00000000000 --- a/src/librustc/rustc.rs +++ /dev/null @@ -1,261 +0,0 @@ -// -*- rust -*- -use result::{Ok, Err}; -use io::ReaderUtil; -use std::getopts; -use std::map::HashMap; -use getopts::{opt_present}; -use getopts::groups; -use syntax::codemap; -use syntax::diagnostic; -use driver::driver::{host_triple, optgroups, early_error, - str_input, file_input, build_session_options, - build_session, build_configuration, parse_pretty, - pp_mode, pretty_print_input, list_metadata, - compile_input}; -use driver::session; -use middle::lint; - -fn version(argv0: &str) { - let mut vers = ~"unknown version"; - let env_vers = env!("CFG_VERSION"); - if env_vers.len() != 0 { vers = env_vers; } - io::println(fmt!("%s %s", argv0, vers)); - io::println(fmt!("host: %s", host_triple())); -} - -fn usage(argv0: &str) { - let message = fmt!("Usage: %s [OPTIONS] INPUT", argv0); - io::println(groups::usage(message, optgroups()) + - ~"Additional help: - -W help Print 'lint' options and default settings - -Z help Print internal options for debugging rustc -"); -} - -fn describe_warnings() { - io::println(fmt!(" -Available lint options: - -W Warn about - -A Allow - -D Deny - -F Forbid (deny, and deny all overrides) -")); - - let lint_dict = lint::get_lint_dict(); - let mut max_key = 0; - for lint_dict.each_key |k| { max_key = uint::max(k.len(), max_key); } - fn padded(max: uint, s: &str) -> ~str { - str::from_bytes(vec::from_elem(max - s.len(), ' ' as u8)) + s - } - io::println(fmt!("\nAvailable lint checks:\n")); - io::println(fmt!(" %s %7.7s %s", - padded(max_key, ~"name"), ~"default", ~"meaning")); - io::println(fmt!(" %s %7.7s %s\n", - padded(max_key, ~"----"), ~"-------", ~"-------")); - for lint_dict.each |k, v| { - let k = str::replace(k, ~"_", ~"-"); - io::println(fmt!(" %s %7.7s %s", - padded(max_key, k), - match v.default { - lint::allow => ~"allow", - lint::warn => ~"warn", - lint::deny => ~"deny", - lint::forbid => ~"forbid" - }, - v.desc)); - } - io::println(~""); -} - -fn describe_debug_flags() { - io::println(fmt!("\nAvailable debug options:\n")); - for session::debugging_opts_map().each |pair| { - let (name, desc, _) = *pair; - io::println(fmt!(" -Z %-20s -- %s", name, desc)); - } -} - -fn run_compiler(args: &~[~str], demitter: diagnostic::emitter) { - // Don't display log spew by default. Can override with RUST_LOG. - logging::console_off(); - - let mut args = *args; - let binary = args.shift(); - - if args.is_empty() { usage(binary); return; } - - let matches = - match getopts::groups::getopts(args, optgroups()) { - Ok(m) => m, - Err(f) => { - early_error(demitter, getopts::fail_str(f)) - } - }; - - if opt_present(matches, ~"h") || opt_present(matches, ~"help") { - usage(binary); - return; - } - - let lint_flags = vec::append(getopts::opt_strs(matches, ~"W"), - getopts::opt_strs(matches, ~"warn")); - if lint_flags.contains(&~"help") { - describe_warnings(); - return; - } - - if getopts::opt_strs(matches, ~"Z").contains(&~"help") { - describe_debug_flags(); - return; - } - - if opt_present(matches, ~"v") || opt_present(matches, ~"version") { - version(binary); - return; - } - let input = match vec::len(matches.free) { - 0u => early_error(demitter, ~"no input filename given"), - 1u => { - let ifile = matches.free[0]; - if ifile == ~"-" { - let src = str::from_bytes(io::stdin().read_whole_stream()); - str_input(src) - } else { - file_input(Path(ifile)) - } - } - _ => early_error(demitter, ~"multiple input filenames provided") - }; - - let sopts = build_session_options(binary, matches, demitter); - let sess = build_session(sopts, demitter); - let odir = getopts::opt_maybe_str(matches, ~"out-dir"); - let odir = odir.map(|o| Path(*o)); - let ofile = getopts::opt_maybe_str(matches, ~"o"); - let ofile = ofile.map(|o| Path(*o)); - let cfg = build_configuration(sess, binary, input); - let pretty = - option::map(&getopts::opt_default(matches, ~"pretty", - ~"normal"), - |a| parse_pretty(sess, *a) ); - match pretty { - Some::(ppm) => { - pretty_print_input(sess, cfg, input, ppm); - return; - } - None:: => {/* continue */ } - } - let ls = opt_present(matches, ~"ls"); - if ls { - match input { - file_input(ifile) => { - list_metadata(sess, &ifile, io::stdout()); - } - str_input(_) => { - early_error(demitter, ~"can not list metadata for stdin"); - } - } - return; - } - - compile_input(sess, cfg, input, &odir, &ofile); -} - -enum monitor_msg { - fatal, - done, -} - -impl monitor_msg : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &monitor_msg) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] - pure fn eq(&self, other: &monitor_msg) -> bool { - ((*self) as uint) == ((*other) as uint) - } - #[cfg(stage0)] - pure fn ne(other: &monitor_msg) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] - pure fn ne(&self, other: &monitor_msg) -> bool { !(*self).eq(other) } -} - -/* -This is a sanity check that any failure of the compiler is performed -through the diagnostic module and reported properly - we shouldn't be calling -plain-old-fail on any execution path that might be taken. Since we have -console logging off by default, hitting a plain fail statement would make the -compiler silently exit, which would be terrible. - -This method wraps the compiler in a subtask and injects a function into the -diagnostic emitter which records when we hit a fatal error. If the task -fails without recording a fatal error then we've encountered a compiler -bug and need to present an error. -*/ -fn monitor(+f: fn~(diagnostic::emitter)) { - let p = comm::Port(); - let ch = comm::Chan(&p); - - match do task::try |move f| { - - // The 'diagnostics emitter'. Every error, warning, etc. should - // go through this function. - let demitter = fn@(cmsp: Option<(@codemap::CodeMap, codemap::span)>, - msg: &str, lvl: diagnostic::level) { - if lvl == diagnostic::fatal { - comm::send(ch, fatal); - } - diagnostic::emit(cmsp, msg, lvl); - }; - - struct finally { - ch: comm::Chan, - drop { comm::send(self.ch, done); } - } - - let _finally = finally { ch: ch }; - - f(demitter) - } { - result::Ok(_) => { /* fallthrough */ } - result::Err(_) => { - // Task failed without emitting a fatal diagnostic - if comm::recv(p) == done { - diagnostic::emit( - None, - diagnostic::ice_msg(~"unexpected failure"), - diagnostic::error); - - for [ - ~"the compiler hit an unexpected failure path. \ - this is a bug", - ~"try running with RUST_LOG=rustc=1,::rt::backtrace \ - to get further details and report the results \ - to github.com/mozilla/rust/issues" - ].each |note| { - diagnostic::emit(None, *note, diagnostic::note) - } - } - // Fail so the process returns a failure code - fail; - } - } -} - -fn main() { - let mut args = os::args(); - do monitor |move args, demitter| { - run_compiler(&args, demitter); - } -} - -// Local Variables: -// mode: rust -// fill-column: 78; -// indent-tabs-mode: nil -// c-basic-offset: 4 -// buffer-file-coding-system: utf-8-unix -// End: diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index 4369f8f10dc..4dfbda4e29e 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -11,19 +11,9 @@ pub enum OutputFormat { } impl OutputFormat : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &OutputFormat) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &OutputFormat) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &OutputFormat) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &OutputFormat) -> bool { !(*self).eq(other) } } @@ -36,19 +26,9 @@ pub enum OutputStyle { } impl OutputStyle : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &OutputStyle) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &OutputStyle) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &OutputStyle) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &OutputStyle) -> bool { !(*self).eq(other) } } diff --git a/src/librustdoc/doc.rs b/src/librustdoc/doc.rs index a1ac12cbc3a..16fba7a9ffd 100644 --- a/src/librustdoc/doc.rs +++ b/src/librustdoc/doc.rs @@ -7,19 +7,9 @@ pub type Doc_ = { }; impl Doc_ : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &Doc_) -> bool { - self.pages == (*other).pages - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &Doc_) -> bool { (*self).pages == (*other).pages } - #[cfg(stage0)] - pure fn ne(other: &Doc_) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &Doc_) -> bool { !(*self).eq(other) } } @@ -28,15 +18,7 @@ pub enum Doc { } impl Doc : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &Doc) -> bool { *self == *(*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &Doc) -> bool { *(*self) == *(*other) } - #[cfg(stage0)] - pure fn ne(other: &Doc) -> bool { *self != *(*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &Doc) -> bool { *(*self) != *(*other) } } @@ -46,25 +28,6 @@ pub enum Page { } impl Page : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &Page) -> bool { - match self { - CratePage(e0a) => { - match (*other) { - CratePage(e0b) => e0a == e0b, - _ => false - } - } - ItemPage(e0a) => { - match (*other) { - ItemPage(e0b) => e0a == e0b, - _ => false - } - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &Page) -> bool { match (*self) { CratePage(e0a) => { @@ -81,10 +44,6 @@ impl Page : cmp::Eq { } } } - #[cfg(stage0)] - pure fn ne(other: &Page) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &Page) -> bool { !(*self).eq(other) } } @@ -94,19 +53,9 @@ pub enum Implementation { } impl Implementation : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &Implementation) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &Implementation) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &Implementation) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &Implementation) -> bool { !(*self).eq(other) } } @@ -121,19 +70,9 @@ pub type Section = { }; impl Section : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &Section) -> bool { - self.header == (*other).header && self.body == (*other).body - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &Section) -> bool { (*self).header == (*other).header && (*self).body == (*other).body } - #[cfg(stage0)] - pure fn ne(other: &Section) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &Section) -> bool { !(*self).eq(other) } } @@ -145,19 +84,9 @@ pub type CrateDoc = { }; impl CrateDoc : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &CrateDoc) -> bool { - self.topmod == (*other).topmod - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &CrateDoc) -> bool { (*self).topmod == (*other).topmod } - #[cfg(stage0)] - pure fn ne(other: &CrateDoc) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &CrateDoc) -> bool { !(*self).eq(other) } } @@ -174,67 +103,6 @@ pub enum ItemTag { } impl ItemTag : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &ItemTag) -> bool { - match self { - ModTag(e0a) => { - match (*other) { - ModTag(e0b) => e0a == e0b, - _ => false - } - } - NmodTag(e0a) => { - match (*other) { - NmodTag(e0b) => e0a == e0b, - _ => false - } - } - ConstTag(e0a) => { - match (*other) { - ConstTag(e0b) => e0a == e0b, - _ => false - } - } - FnTag(e0a) => { - match (*other) { - FnTag(e0b) => e0a == e0b, - _ => false - } - } - EnumTag(e0a) => { - match (*other) { - EnumTag(e0b) => e0a == e0b, - _ => false - } - } - TraitTag(e0a) => { - match (*other) { - TraitTag(e0b) => e0a == e0b, - _ => false - } - } - ImplTag(e0a) => { - match (*other) { - ImplTag(e0b) => e0a == e0b, - _ => false - } - } - TyTag(e0a) => { - match (*other) { - TyTag(e0b) => e0a == e0b, - _ => false - } - } - StructTag(e0a) => { - match (*other) { - StructTag(e0b) => e0a == e0b, - _ => false - } - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &ItemTag) -> bool { match (*self) { ModTag(e0a) => { @@ -293,10 +161,6 @@ impl ItemTag : cmp::Eq { } } } - #[cfg(stage0)] - pure fn ne(other: &ItemTag) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &ItemTag) -> bool { !(*self).eq(other) } } @@ -312,18 +176,6 @@ pub type ItemDoc = { }; impl ItemDoc : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &ItemDoc) -> bool { - self.id == (*other).id && - self.name == (*other).name && - self.path == (*other).path && - self.brief == (*other).brief && - self.desc == (*other).desc && - self.sections == (*other).sections && - self.reexport == (*other).reexport - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &ItemDoc) -> bool { (*self).id == (*other).id && (*self).name == (*other).name && @@ -333,10 +185,6 @@ impl ItemDoc : cmp::Eq { (*self).sections == (*other).sections && (*self).reexport == (*other).reexport } - #[cfg(stage0)] - pure fn ne(other: &ItemDoc) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &ItemDoc) -> bool { !(*self).eq(other) } } @@ -346,19 +194,9 @@ pub type SimpleItemDoc = { }; impl SimpleItemDoc : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &SimpleItemDoc) -> bool { - self.item == (*other).item && self.sig == (*other).sig - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &SimpleItemDoc) -> bool { (*self).item == (*other).item && (*self).sig == (*other).sig } - #[cfg(stage0)] - pure fn ne(other: &SimpleItemDoc) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &SimpleItemDoc) -> bool { !(*self).eq(other) } } @@ -369,23 +207,11 @@ pub type ModDoc_ = { }; impl ModDoc_ : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &ModDoc_) -> bool { - self.item == (*other).item && - self.items == (*other).items && - self.index == (*other).index - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &ModDoc_) -> bool { (*self).item == (*other).item && (*self).items == (*other).items && (*self).index == (*other).index } - #[cfg(stage0)] - pure fn ne(other: &ModDoc_) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &ModDoc_) -> bool { !(*self).eq(other) } } @@ -394,15 +220,7 @@ pub enum ModDoc { } impl ModDoc : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &ModDoc) -> bool { *self == *(*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &ModDoc) -> bool { *(*self) == *(*other) } - #[cfg(stage0)] - pure fn ne(other: &ModDoc) -> bool { *self != *(*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &ModDoc) -> bool { *(*self) != *(*other) } } @@ -413,23 +231,11 @@ pub type NmodDoc = { }; impl NmodDoc : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &NmodDoc) -> bool { - self.item == (*other).item && - self.fns == (*other).fns && - self.index == (*other).index - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &NmodDoc) -> bool { (*self).item == (*other).item && (*self).fns == (*other).fns && (*self).index == (*other).index } - #[cfg(stage0)] - pure fn ne(other: &NmodDoc) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &NmodDoc) -> bool { !(*self).eq(other) } } @@ -443,19 +249,9 @@ pub type EnumDoc = { }; impl EnumDoc : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &EnumDoc) -> bool { - self.item == (*other).item && self.variants == (*other).variants - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &EnumDoc) -> bool { (*self).item == (*other).item && (*self).variants == (*other).variants } - #[cfg(stage0)] - pure fn ne(other: &EnumDoc) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &EnumDoc) -> bool { !(*self).eq(other) } } @@ -466,23 +262,11 @@ pub type VariantDoc = { }; impl VariantDoc : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &VariantDoc) -> bool { - self.name == (*other).name && - self.desc == (*other).desc && - self.sig == (*other).sig - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &VariantDoc) -> bool { (*self).name == (*other).name && (*self).desc == (*other).desc && (*self).sig == (*other).sig } - #[cfg(stage0)] - pure fn ne(other: &VariantDoc) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &VariantDoc) -> bool { !(*self).eq(other) } } @@ -492,19 +276,9 @@ pub type TraitDoc = { }; impl TraitDoc : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &TraitDoc) -> bool { - self.item == (*other).item && self.methods == (*other).methods - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &TraitDoc) -> bool { (*self).item == (*other).item && (*self).methods == (*other).methods } - #[cfg(stage0)] - pure fn ne(other: &TraitDoc) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &TraitDoc) -> bool { !(*self).eq(other) } } @@ -518,17 +292,6 @@ pub type MethodDoc = { }; impl MethodDoc : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &MethodDoc) -> bool { - self.name == (*other).name && - self.brief == (*other).brief && - self.desc == (*other).desc && - self.sections == (*other).sections && - self.sig == (*other).sig && - self.implementation == (*other).implementation - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &MethodDoc) -> bool { (*self).name == (*other).name && (*self).brief == (*other).brief && @@ -537,10 +300,6 @@ impl MethodDoc : cmp::Eq { (*self).sig == (*other).sig && (*self).implementation == (*other).implementation } - #[cfg(stage0)] - pure fn ne(other: &MethodDoc) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &MethodDoc) -> bool { !(*self).eq(other) } } @@ -552,25 +311,12 @@ pub type ImplDoc = { }; impl ImplDoc : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &ImplDoc) -> bool { - self.item == (*other).item && - self.trait_types == (*other).trait_types && - self.self_ty == (*other).self_ty && - self.methods == (*other).methods - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &ImplDoc) -> bool { (*self).item == (*other).item && (*self).trait_types == (*other).trait_types && (*self).self_ty == (*other).self_ty && (*self).methods == (*other).methods } - #[cfg(stage0)] - pure fn ne(other: &ImplDoc) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &ImplDoc) -> bool { !(*self).eq(other) } } @@ -583,23 +329,11 @@ pub type StructDoc = { }; impl StructDoc : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &StructDoc) -> bool { - return self.item == other.item - && self.fields == other.fields - && self.sig == other.sig; - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &StructDoc) -> bool { return (*self).item == other.item && (*self).fields == other.fields && (*self).sig == other.sig; } - #[cfg(stage0)] - pure fn ne(other: &StructDoc) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &StructDoc) -> bool { !(*self).eq(other) } } @@ -608,19 +342,9 @@ pub type Index = { }; impl Index : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &Index) -> bool { - self.entries == (*other).entries - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &Index) -> bool { (*self).entries == (*other).entries } - #[cfg(stage0)] - pure fn ne(other: &Index) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &Index) -> bool { !(*self).eq(other) } } @@ -642,25 +366,12 @@ pub type IndexEntry = { }; impl IndexEntry : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &IndexEntry) -> bool { - self.kind == (*other).kind && - self.name == (*other).name && - self.brief == (*other).brief && - self.link == (*other).link - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &IndexEntry) -> bool { (*self).kind == (*other).kind && (*self).name == (*other).name && (*self).brief == (*other).brief && (*self).link == (*other).link } - #[cfg(stage0)] - pure fn ne(other: &IndexEntry) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &IndexEntry) -> bool { !(*self).eq(other) } } diff --git a/src/libstd/deque.rs b/src/libstd/deque.rs index 44ddb307019..f33ff892f36 100644 --- a/src/libstd/deque.rs +++ b/src/libstd/deque.rs @@ -239,25 +239,6 @@ mod tests { type RecCy = {x: int, y: int, t: Taggy}; impl Taggy : Eq { - #[cfg(stage0)] - pure fn eq(other: &Taggy) -> bool { - match self { - One(a1) => match (*other) { - One(b1) => return a1 == b1, - _ => return false - }, - Two(a1, a2) => match (*other) { - Two(b1, b2) => return a1 == b1 && a2 == b2, - _ => return false - }, - Three(a1, a2, a3) => match (*other) { - Three(b1, b2, b3) => return a1 == b1 && a2 == b2 && a3 == b3, - _ => return false - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &Taggy) -> bool { match (*self) { One(a1) => match (*other) { @@ -274,36 +255,11 @@ mod tests { } } } - #[cfg(stage0)] - pure fn ne(other: &Taggy) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &Taggy) -> bool { !(*self).eq(other) } } impl Taggypar : Eq { //let eq4: EqFn> = |x,y| taggypareq::(x, y); - #[cfg(stage0)] - pure fn eq(other: &Taggypar) -> bool { - match self { - Onepar::(a1) => match (*other) { - Onepar::(b1) => return a1 == b1, - _ => return false - }, - Twopar::(a1, a2) => match (*other) { - Twopar::(b1, b2) => return a1 == b1 && a2 == b2, - _ => return false - }, - Threepar::(a1, a2, a3) => match (*other) { - Threepar::(b1, b2, b3) => { - return a1 == b1 && a2 == b2 && a3 == b3 - } - _ => return false - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &Taggypar) -> bool { match (*self) { Onepar::(a1) => match (*other) { @@ -322,33 +278,16 @@ mod tests { } } } - #[cfg(stage0)] - pure fn ne(other: &Taggypar) -> bool { - !self.eq(other) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &Taggypar) -> bool { !(*self).eq(other) } } impl RecCy : Eq { - #[cfg(stage0)] - pure fn eq(other: &RecCy) -> bool { - return self.x == (*other).x && self.y == (*other).y && - self.t == (*other).t; - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &RecCy) -> bool { return (*self).x == (*other).x && (*self).y == (*other).y && (*self).t == (*other).t; } - #[cfg(stage0)] - pure fn ne(other: &RecCy) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &RecCy) -> bool { !(*self).eq(other) } } diff --git a/src/libstd/getopts.rs b/src/libstd/getopts.rs index cd7823b9747..44296a009e7 100644 --- a/src/libstd/getopts.rs +++ b/src/libstd/getopts.rs @@ -88,25 +88,6 @@ fn mkname(nm: &str) -> Name { } impl Name : Eq { - #[cfg(stage0)] - pure fn eq(other: &Name) -> bool { - match self { - Long(ref e0a) => { - match (*other) { - Long(ref e0b) => e0a == e0b, - _ => false - } - } - Short(e0a) => { - match (*other) { - Short(e0b) => e0a == e0b, - _ => false - } - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &Name) -> bool { match (*self) { Long(ref e0a) => { @@ -123,65 +104,29 @@ impl Name : Eq { } } } - #[cfg(stage0)] - pure fn ne(other: &Name) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &Name) -> bool { !(*self).eq(other) } } impl Occur : Eq { - #[cfg(stage0)] - pure fn eq(other: &Occur) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &Occur) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &Occur) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &Occur) -> bool { !(*self).eq(other) } } impl HasArg : Eq { - #[cfg(stage0)] - pure fn eq(other: &HasArg) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &HasArg) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &HasArg) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &HasArg) -> bool { !(*self).eq(other) } } impl Opt : Eq { - #[cfg(stage0)] - pure fn eq(other: &Opt) -> bool { - self.name == (*other).name && - self.hasarg == (*other).hasarg && - self.occur == (*other).occur - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &Opt) -> bool { (*self).name == (*other).name && (*self).hasarg == (*other).hasarg && (*self).occur == (*other).occur } - #[cfg(stage0)] - pure fn ne(other: &Opt) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &Opt) -> bool { !(*self).eq(other) } } @@ -227,17 +172,6 @@ enum Optval { Val(~str), Given, } pub type Matches = {opts: ~[Opt], vals: ~[~[Optval]], free: ~[~str]}; impl Optval : Eq { - #[cfg(stage0)] - pure fn eq(other: &Optval) -> bool { - match self { - Val(ref s) => match *other { Val (ref os) => s == os, - Given => false }, - Given => match *other { Val(_) => false, - Given => true } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &Optval) -> bool { match (*self) { Val(ref s) => match *other { Val (ref os) => s == os, @@ -246,31 +180,15 @@ impl Optval : Eq { Given => true } } } - #[cfg(stage0)] - pure fn ne(other: &Optval) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &Optval) -> bool { !(*self).eq(other) } } impl Matches : Eq { - #[cfg(stage0)] - pure fn eq(other: &Matches) -> bool { - self.opts == (*other).opts && - self.vals == (*other).vals && - self.free == (*other).free - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &Matches) -> bool { (*self).opts == (*other).opts && (*self).vals == (*other).vals && (*self).free == (*other).free } - #[cfg(stage0)] - pure fn ne(other: &Matches) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &Matches) -> bool { !(*self).eq(other) } } @@ -303,33 +221,6 @@ pub enum Fail_ { impl Fail_ : Eq { // this whole thing should be easy to infer... - #[cfg(stage0)] - pure fn eq(other: &Fail_) -> bool { - match self { - ArgumentMissing(ref s) => { - match *other { ArgumentMissing(ref so) => s == so, - _ => false } - } - UnrecognizedOption(ref s) => { - match *other { UnrecognizedOption(ref so) => s == so, - _ => false } - } - OptionMissing(ref s) => { - match *other { OptionMissing(ref so) => s == so, - _ => false } - } - OptionDuplicated(ref s) => { - match *other { OptionDuplicated(ref so) => s == so, - _ => false } - } - UnexpectedArgument(ref s) => { - match *other { UnexpectedArgument(ref so) => s == so, - _ => false } - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &Fail_) -> bool { match (*self) { ArgumentMissing(ref s) => { @@ -354,10 +245,6 @@ impl Fail_ : Eq { } } } - #[cfg(stage0)] - pure fn ne(other: &Fail_) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &Fail_) -> bool { !(*self).eq(other) } } @@ -627,19 +514,9 @@ enum FailType { } impl FailType : Eq { - #[cfg(stage0)] - pure fn eq(other: &FailType) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &FailType) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &FailType) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &FailType) -> bool { !(*self).eq(other) } } @@ -661,17 +538,6 @@ pub mod groups { }; impl OptGroup : Eq { - #[cfg(stage0)] - pure fn eq(other: &OptGroup) -> bool { - self.short_name == (*other).short_name && - self.long_name == (*other).long_name && - self.hint == (*other).hint && - self.desc == (*other).desc && - self.hasarg == (*other).hasarg && - self.occur == (*other).occur - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &OptGroup) -> bool { (*self).short_name == (*other).short_name && (*self).long_name == (*other).long_name && @@ -680,11 +546,9 @@ pub mod groups { (*self).hasarg == (*other).hasarg && (*self).occur == (*other).occur } - #[cfg(stage0)] - pure fn ne(other: &OptGroup) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] - pure fn ne(&self, other: &OptGroup) -> bool { !(*self).eq(other) } + pure fn ne(&self, other: &OptGroup) -> bool { + !self.eq(other) + } } /// Create a long option that is required and takes an argument diff --git a/src/libstd/json.rs b/src/libstd/json.rs index e638fc79746..8551072d461 100644 --- a/src/libstd/json.rs +++ b/src/libstd/json.rs @@ -905,44 +905,6 @@ pub impl Deserializer: serialization::Deserializer { } impl Json : Eq { - #[cfg(stage0)] - pure fn eq(other: &Json) -> bool { - // XXX: This is ugly because matching on references is broken, and - // we can't match on dereferenced tuples without a copy. - match self { - Number(f0) => - match *other { Number(f1) => f0 == f1, _ => false }, - String(ref s0) => - match *other { String(ref s1) => s0 == s1, _ => false }, - Boolean(b0) => - match *other { Boolean(b1) => b0 == b1, _ => false }, - Null => - match *other { Null => true, _ => false }, - List(v0) => - match *other { List(v1) => v0 == v1, _ => false }, - Object(ref d0) => { - match *other { - Object(ref d1) => { - if d0.len() == d1.len() { - let mut equal = true; - for d0.each |k, v0| { - match d1.find_ref(k) { - Some(v1) if v0 == v1 => { }, - _ => { equal = false; break } - } - }; - equal - } else { - false - } - } - _ => false - } - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &Json) -> bool { // XXX: This is ugly because matching on references is broken, and // we can't match on dereferenced tuples without a copy. @@ -978,88 +940,11 @@ impl Json : Eq { } } } - #[cfg(stage0)] - pure fn ne(other: &Json) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &Json) -> bool { !(*self).eq(other) } } /// Test if two json values are less than one another impl Json : Ord { - #[cfg(stage0)] - pure fn lt(other: &Json) -> bool { - match self { - Number(f0) => { - match *other { - Number(f1) => f0 < f1, - String(_) | Boolean(_) | List(_) | Object(_) | - Null => true - } - } - - String(ref s0) => { - match *other { - Number(_) => false, - String(ref s1) => s0 < s1, - Boolean(_) | List(_) | Object(_) | Null => true - } - } - - Boolean(b0) => { - match *other { - Number(_) | String(_) => false, - Boolean(b1) => b0 < b1, - List(_) | Object(_) | Null => true - } - } - - List(l0) => { - match *other { - Number(_) | String(_) | Boolean(_) => false, - List(l1) => l0 < l1, - Object(_) | Null => true - } - } - - Object(ref d0) => { - match *other { - Number(_) | String(_) | Boolean(_) | List(_) => false, - Object(ref d1) => { - unsafe { - let mut d0_flat = ~[]; - let mut d1_flat = ~[]; - - // XXX: this is horribly inefficient... - for d0.each |k, v| { - d0_flat.push((@copy *k, @copy *v)); - } - d0_flat.qsort(); - - for d1.each |k, v| { - d1_flat.push((@copy *k, @copy *v)); - } - d1_flat.qsort(); - - d0_flat < d1_flat - } - } - Null => true - } - } - - Null => { - match *other { - Number(_) | String(_) | Boolean(_) | List(_) | - Object(_) => - false, - Null => true - } - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn lt(&self, other: &Json) -> bool { match (*self) { Number(f0) => { @@ -1130,41 +1015,17 @@ impl Json : Ord { } } } - #[cfg(stage0)] - pure fn le(other: &Json) -> bool { !(*other).lt(&self) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn le(&self, other: &Json) -> bool { !(*other).lt(&(*self)) } - #[cfg(stage0)] - pure fn ge(other: &Json) -> bool { !self.lt(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ge(&self, other: &Json) -> bool { !(*self).lt(other) } - #[cfg(stage0)] - pure fn gt(other: &Json) -> bool { (*other).lt(&self) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn gt(&self, other: &Json) -> bool { (*other).lt(&(*self)) } } impl Error : Eq { - #[cfg(stage0)] - pure fn eq(other: &Error) -> bool { - self.line == other.line && - self.col == other.col && - self.msg == other.msg - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &Error) -> bool { (*self).line == other.line && (*self).col == other.col && (*self).msg == other.msg } - #[cfg(stage0)] - pure fn ne(other: &Error) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &Error) -> bool { !(*self).eq(other) } } diff --git a/src/libstd/list.rs b/src/libstd/list.rs index 35b9a92f5a8..ccff91634b8 100644 --- a/src/libstd/list.rs +++ b/src/libstd/list.rs @@ -148,25 +148,6 @@ pub fn each(l: @List, f: fn(&T) -> bool) { } impl List : Eq { - #[cfg(stage0)] - pure fn eq(other: &List) -> bool { - match self { - Cons(ref e0a, e1a) => { - match (*other) { - Cons(ref e0b, e1b) => e0a == e0b && e1a == e1b, - _ => false - } - } - Nil => { - match (*other) { - Nil => true, - _ => false - } - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &List) -> bool { match (*self) { Cons(ref e0a, e1a) => { @@ -183,10 +164,6 @@ impl List : Eq { } } } - #[cfg(stage0)] - pure fn ne(other: &List) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &List) -> bool { !(*self).eq(other) } } diff --git a/src/libstd/net_url.rs b/src/libstd/net_url.rs index ec9aa60de54..36fb86e0c49 100644 --- a/src/libstd/net_url.rs +++ b/src/libstd/net_url.rs @@ -315,19 +315,9 @@ pure fn userinfo_to_str(userinfo: UserInfo) -> ~str { } impl UserInfo : Eq { - #[cfg(stage0)] - pure fn eq(other: &UserInfo) -> bool { - self.user == (*other).user && self.pass == (*other).pass - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &UserInfo) -> bool { (*self).user == (*other).user && (*self).pass == (*other).pass } - #[cfg(stage0)] - pure fn ne(other: &UserInfo) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &UserInfo) -> bool { !(*self).eq(other) } } @@ -389,19 +379,6 @@ enum Input { } impl Input : Eq { - #[cfg(stage0)] - pure fn eq(other: &Input) -> bool { - match (self, (*other)) { - (Digit, Digit) => true, - (Hex, Hex) => true, - (Unreserved, Unreserved) => true, - (Digit, _) => false, - (Hex, _) => false, - (Unreserved, _) => false - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &Input) -> bool { match ((*self), (*other)) { (Digit, Digit) => true, @@ -412,10 +389,6 @@ impl Input : Eq { (Unreserved, _) => false } } - #[cfg(stage0)] - pure fn ne(other: &Input) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &Input) -> bool { !(*self).eq(other) } } @@ -749,18 +722,6 @@ impl Url: to_str::ToStr { } impl Url : Eq { - #[cfg(stage0)] - pure fn eq(other: &Url) -> bool { - self.scheme == (*other).scheme - && self.user == (*other).user - && self.host == (*other).host - && self.port == (*other).port - && self.path == (*other).path - && self.query == (*other).query - && self.fragment == (*other).fragment - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &Url) -> bool { (*self).scheme == (*other).scheme && (*self).user == (*other).user @@ -771,12 +732,6 @@ impl Url : Eq { && (*self).fragment == (*other).fragment } - #[cfg(stage0)] - pure fn ne(other: &Url) -> bool { - !self.eq(other) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &Url) -> bool { !(*self).eq(other) } diff --git a/src/libstd/sort.rs b/src/libstd/sort.rs index 73529fd2a93..c6e8c72e6d6 100644 --- a/src/libstd/sort.rs +++ b/src/libstd/sort.rs @@ -871,16 +871,6 @@ mod test_tim_sort { } impl CVal: Ord { - #[cfg(stage0)] - pure fn lt(other: &CVal) -> bool { - unsafe { - let rng = rand::Rng(); - if rng.gen_float() > 0.995 { fail ~"It's happening!!!"; } - } - self.val < other.val - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn lt(&self, other: &CVal) -> bool { unsafe { let rng = rand::Rng(); @@ -888,20 +878,8 @@ mod test_tim_sort { } (*self).val < other.val } - #[cfg(stage0)] - pure fn le(other: &CVal) -> bool { self.val <= other.val } - #[cfg(stage1)] - #[cfg(stage2)] pure fn le(&self, other: &CVal) -> bool { (*self).val <= other.val } - #[cfg(stage0)] - pure fn gt(other: &CVal) -> bool { self.val > other.val } - #[cfg(stage1)] - #[cfg(stage2)] pure fn gt(&self, other: &CVal) -> bool { (*self).val > other.val } - #[cfg(stage0)] - pure fn ge(other: &CVal) -> bool { self.val >= other.val } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ge(&self, other: &CVal) -> bool { (*self).val >= other.val } } @@ -957,16 +935,6 @@ mod test_tim_sort { struct DVal { val: uint } - #[cfg(stage0)] - impl DVal: Ord { - pure fn lt(_x: &DVal) -> bool { true } - pure fn le(_x: &DVal) -> bool { true } - pure fn gt(_x: &DVal) -> bool { true } - pure fn ge(_x: &DVal) -> bool { true } - } - - #[cfg(stage1)] - #[cfg(stage2)] impl DVal: Ord { pure fn lt(&self, _x: &DVal) -> bool { true } pure fn le(&self, _x: &DVal) -> bool { true } @@ -1183,39 +1151,15 @@ mod big_tests { } impl LVal: Ord { - #[cfg(stage0)] - pure fn lt(other: &a/LVal/&self) -> bool { - self.val < other.val - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn lt(&self, other: &a/LVal/&self) -> bool { (*self).val < other.val } - #[cfg(stage0)] - pure fn le(other: &a/LVal/&self) -> bool { - self.val <= other.val - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn le(&self, other: &a/LVal/&self) -> bool { (*self).val <= other.val } - #[cfg(stage0)] - pure fn gt(other: &a/LVal/&self) -> bool { - self.val > other.val - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn gt(&self, other: &a/LVal/&self) -> bool { (*self).val > other.val } - #[cfg(stage0)] - pure fn ge(other: &a/LVal/&self) -> bool { - self.val >= other.val - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ge(&self, other: &a/LVal/&self) -> bool { (*self).val >= other.val } diff --git a/src/libstd/test.rs b/src/libstd/test.rs index 54f011d246c..b3b5e978414 100644 --- a/src/libstd/test.rs +++ b/src/libstd/test.rs @@ -85,19 +85,9 @@ fn parse_opts(args: &[~str]) -> OptRes { pub enum TestResult { TrOk, TrFailed, TrIgnored, } impl TestResult : Eq { - #[cfg(stage0)] - pure fn eq(other: &TestResult) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &TestResult) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &TestResult) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &TestResult) -> bool { !(*self).eq(other) } } diff --git a/src/libstd/time.rs b/src/libstd/time.rs index 405d1d7abad..7596f4282b7 100644 --- a/src/libstd/time.rs +++ b/src/libstd/time.rs @@ -24,19 +24,9 @@ extern mod rustrt { pub type Timespec = {sec: i64, nsec: i32}; impl Timespec : Eq { - #[cfg(stage0)] - pure fn eq(other: &Timespec) -> bool { - self.sec == (*other).sec && self.nsec == (*other).nsec - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &Timespec) -> bool { (*self).sec == (*other).sec && (*self).nsec == (*other).nsec } - #[cfg(stage0)] - pure fn ne(other: &Timespec) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &Timespec) -> bool { !(*self).eq(other) } } @@ -91,23 +81,6 @@ type Tm_ = { }; impl Tm_ : Eq { - #[cfg(stage0)] - pure fn eq(other: &Tm_) -> bool { - self.tm_sec == (*other).tm_sec && - self.tm_min == (*other).tm_min && - self.tm_hour == (*other).tm_hour && - self.tm_mday == (*other).tm_mday && - self.tm_mon == (*other).tm_mon && - self.tm_year == (*other).tm_year && - self.tm_wday == (*other).tm_wday && - self.tm_yday == (*other).tm_yday && - self.tm_isdst == (*other).tm_isdst && - self.tm_gmtoff == (*other).tm_gmtoff && - self.tm_zone == (*other).tm_zone && - self.tm_nsec == (*other).tm_nsec - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &Tm_) -> bool { (*self).tm_sec == (*other).tm_sec && (*self).tm_min == (*other).tm_min && @@ -122,10 +95,6 @@ impl Tm_ : Eq { (*self).tm_zone == (*other).tm_zone && (*self).tm_nsec == (*other).tm_nsec } - #[cfg(stage0)] - pure fn ne(other: &Tm_) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &Tm_) -> bool { !(*self).eq(other) } } @@ -134,15 +103,7 @@ pub enum Tm { } impl Tm : Eq { - #[cfg(stage0)] - pure fn eq(other: &Tm) -> bool { *self == *(*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &Tm) -> bool { *(*self) == *(*other) } - #[cfg(stage0)] - pure fn ne(other: &Tm) -> bool { *self != *(*other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &Tm) -> bool { *(*self) != *(*other) } } diff --git a/src/libsyntax/alternate_crate.rc b/src/libsyntax/alternate_crate.rc deleted file mode 100644 index d5a28a716ec..00000000000 --- a/src/libsyntax/alternate_crate.rc +++ /dev/null @@ -1,128 +0,0 @@ -#[link(name = "syntax", - vers = "0.5", - uuid = "9311401b-d6ea-4cd9-a1d9-61f89499c645")]; - - - -#[crate_type = "lib"]; - -#[no_core]; - -#[legacy_modes]; -#[legacy_exports]; - -#[allow(vecs_implicitly_copyable)]; -#[allow(non_camel_case_types)]; -#[allow(deprecated_mode)]; -#[allow(deprecated_pattern)]; - -extern mod core(vers = "0.5"); -extern mod std(vers = "0.5"); - -use core::*; - -#[legacy_exports] -mod attr; -#[legacy_exports] -mod diagnostic; -mod codemap; -#[legacy_exports] -mod ast; -#[legacy_exports] -mod ast_util; -#[legacy_exports] -mod ast_map; -#[legacy_exports] -mod visit; -#[legacy_exports] -mod fold; -#[legacy_exports] -mod util { - #[legacy_exports]; - #[legacy_exports] - #[path = "util/interner.rs"] - mod interner; -} - -#[merge = "parse/mod.rs"] -mod parse; - -mod print { - #[legacy_exports]; - #[legacy_exports] - #[path = "print/pp.rs"] - mod pp; - #[legacy_exports] - #[path = "print/pprust.rs"] - mod pprust; -} - -mod ext { - #[legacy_exports]; - #[legacy_exports] - #[path = "ext/base.rs"] - mod base; - #[legacy_exports] - #[path = "ext/expand.rs"] - mod expand; - #[legacy_exports] - #[path = "ext/qquote.rs"] - mod qquote; - - #[path = "ext/quote.rs"] - mod quote; - #[path = "ext/deriving.rs"] - mod deriving; - - #[legacy_exports] - #[path = "ext/build.rs"] - mod build; - - mod tt { - #[legacy_exports]; - #[legacy_exports] - #[path = "ext/tt/transcribe.rs"] - mod transcribe; - #[legacy_exports] - #[path = "ext/tt/macro_parser.rs"] - mod macro_parser; - #[legacy_exports] - #[path = "ext/tt/macro_rules.rs"] - mod macro_rules; - } - - - #[legacy_exports] - #[path = "ext/simplext.rs"] - mod simplext; - #[legacy_exports] - #[path = "ext/fmt.rs"] - mod fmt; - #[legacy_exports] - #[path = "ext/env.rs"] - mod env; - #[legacy_exports] - #[path = "ext/concat_idents.rs"] - mod concat_idents; - #[legacy_exports] - #[path = "ext/ident_to_str.rs"] - mod ident_to_str; - #[legacy_exports] - #[path = "ext/log_syntax.rs"] - mod log_syntax; - #[legacy_exports] - #[path = "ext/auto_serialize.rs"] - mod auto_serialize; - #[legacy_exports] - #[path = "ext/source_util.rs"] - mod source_util; - - #[legacy_exports] - #[path = "ext/pipes.rs"] - #[merge = "ext/pipes/mod.rs"] - mod pipes; - - #[legacy_exports] - #[path = "ext/trace_macros.rs"] - mod trace_macros; -} diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 21ce366e1c4..1bfb1e77283 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -50,15 +50,7 @@ impl ident: Deserializable { } impl ident: cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &ident) -> bool { self.repr == other.repr } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &ident) -> bool { (*self).repr == other.repr } - #[cfg(stage0)] - pure fn ne(other: &ident) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &ident) -> bool { !(*self).eq(other) } } @@ -88,19 +80,9 @@ type node_id = int; type def_id = {crate: crate_num, node: node_id}; impl def_id : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &def_id) -> bool { - self.crate == (*other).crate && self.node == (*other).node - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &def_id) -> bool { (*self).crate == (*other).crate && (*self).node == (*other).node } - #[cfg(stage0)] - pure fn ne(other: &def_id) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &def_id) -> bool { !(*self).eq(other) } } @@ -149,129 +131,6 @@ enum def { } impl def : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &def) -> bool { - match self { - def_fn(e0a, e1a) => { - match (*other) { - def_fn(e0b, e1b) => e0a == e0b && e1a == e1b, - _ => false - } - } - def_static_method(e0a, e1a, e2a) => { - match (*other) { - def_static_method(e0b, e1b, e2b) => - e0a == e0b && e1a == e1b && e2a == e2b, - _ => false - } - } - def_self(e0a) => { - match (*other) { - def_self(e0b) => e0a == e0b, - _ => false - } - } - def_mod(e0a) => { - match (*other) { - def_mod(e0b) => e0a == e0b, - _ => false - } - } - def_foreign_mod(e0a) => { - match (*other) { - def_foreign_mod(e0b) => e0a == e0b, - _ => false - } - } - def_const(e0a) => { - match (*other) { - def_const(e0b) => e0a == e0b, - _ => false - } - } - def_arg(e0a, e1a) => { - match (*other) { - def_arg(e0b, e1b) => e0a == e0b && e1a == e1b, - _ => false - } - } - def_local(e0a, e1a) => { - match (*other) { - def_local(e0b, e1b) => e0a == e0b && e1a == e1b, - _ => false - } - } - def_variant(e0a, e1a) => { - match (*other) { - def_variant(e0b, e1b) => e0a == e0b && e1a == e1b, - _ => false - } - } - def_ty(e0a) => { - match (*other) { - def_ty(e0b) => e0a == e0b, - _ => false - } - } - def_prim_ty(e0a) => { - match (*other) { - def_prim_ty(e0b) => e0a == e0b, - _ => false - } - } - def_ty_param(e0a, e1a) => { - match (*other) { - def_ty_param(e0b, e1b) => e0a == e0b && e1a == e1b, - _ => false - } - } - def_binding(e0a, e1a) => { - match (*other) { - def_binding(e0b, e1b) => e0a == e0b && e1a == e1b, - _ => false - } - } - def_use(e0a) => { - match (*other) { - def_use(e0b) => e0a == e0b, - _ => false - } - } - def_upvar(e0a, e1a, e2a, e3a) => { - match (*other) { - def_upvar(e0b, e1b, e2b, e3b) => - e0a == e0b && e1a == e1b && e2a == e2b && e3a == e3b, - _ => false - } - } - def_class(e0a) => { - match (*other) { - def_class(e0b) => e0a == e0b, - _ => false - } - } - def_typaram_binder(e0a) => { - match (*other) { - def_typaram_binder(e1a) => e0a == e1a, - _ => false - } - } - def_region(e0a) => { - match (*other) { - def_region(e0b) => e0a == e0b, - _ => false - } - } - def_label(e0a) => { - match (*other) { - def_label(e0b) => e0a == e0b, - _ => false - } - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &def) -> bool { match (*self) { def_fn(e0a, e1a) => { @@ -392,10 +251,6 @@ impl def : cmp::Eq { } } } - #[cfg(stage0)] - pure fn ne(other: &def) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &def) -> bool { !(*self).eq(other) } } @@ -464,37 +319,6 @@ impl binding_mode : to_bytes::IterBytes { } impl binding_mode : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &binding_mode) -> bool { - match self { - bind_by_value => { - match (*other) { - bind_by_value => true, - _ => false - } - } - bind_by_move => { - match (*other) { - bind_by_move => true, - _ => false - } - } - bind_by_ref(e0a) => { - match (*other) { - bind_by_ref(e0b) => e0a == e0b, - _ => false - } - } - bind_by_implicit_ref => { - match (*other) { - bind_by_implicit_ref => true, - _ => false - } - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &binding_mode) -> bool { match (*self) { bind_by_value => { @@ -523,10 +347,6 @@ impl binding_mode : cmp::Eq { } } } - #[cfg(stage0)] - pure fn ne(other: &binding_mode) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &binding_mode) -> bool { !(*self).eq(other) } } @@ -565,19 +385,9 @@ impl mutability : to_bytes::IterBytes { } impl mutability : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &mutability) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &mutability) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &mutability) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &mutability) -> bool { !(*self).eq(other) } } @@ -591,19 +401,9 @@ pub enum Proto { } impl Proto : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &Proto) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &Proto) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &Proto) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &Proto) -> bool { !(*self).eq(other) } } @@ -664,19 +464,9 @@ enum binop { } impl binop : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &binop) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &binop) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &binop) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &binop) -> bool { !(*self).eq(other) } } @@ -691,43 +481,6 @@ enum unop { } impl unop : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &unop) -> bool { - match self { - box(e0a) => { - match (*other) { - box(e0b) => e0a == e0b, - _ => false - } - } - uniq(e0a) => { - match (*other) { - uniq(e0b) => e0a == e0b, - _ => false - } - } - deref => { - match (*other) { - deref => true, - _ => false - } - } - not => { - match (*other) { - not => true, - _ => false - } - } - neg => { - match (*other) { - neg => true, - _ => false - } - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &unop) -> bool { match (*self) { box(e0a) => { @@ -762,12 +515,6 @@ impl unop : cmp::Eq { } } } - #[cfg(stage0)] - pure fn ne(other: &unop) -> bool { - !self.eq(other) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &unop) -> bool { !(*self).eq(other) } @@ -795,25 +542,6 @@ impl inferable : to_bytes::IterBytes { } impl inferable : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &inferable) -> bool { - match self { - expl(e0a) => { - match (*other) { - expl(e0b) => e0a == e0b, - _ => false - } - } - infer(e0a) => { - match (*other) { - infer(e0b) => e0a == e0b, - _ => false - } - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &inferable) -> bool { match (*self) { expl(e0a) => { @@ -830,10 +558,6 @@ impl inferable : cmp::Eq { } } } - #[cfg(stage0)] - pure fn ne(other: &inferable) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &inferable) -> bool { !(*self).eq(other) } } @@ -850,19 +574,9 @@ impl rmode : to_bytes::IterBytes { impl rmode : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &rmode) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &rmode) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &rmode) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &rmode) -> bool { !(*self).eq(other) } } @@ -913,17 +627,6 @@ type field = spanned; enum blk_check_mode { default_blk, unsafe_blk, } impl blk_check_mode : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &blk_check_mode) -> bool { - match (self, (*other)) { - (default_blk, default_blk) => true, - (unsafe_blk, unsafe_blk) => true, - (default_blk, _) => false, - (unsafe_blk, _) => false, - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &blk_check_mode) -> bool { match ((*self), (*other)) { (default_blk, default_blk) => true, @@ -932,10 +635,6 @@ impl blk_check_mode : cmp::Eq { (unsafe_blk, _) => false, } } - #[cfg(stage0)] - pure fn ne(other: &blk_check_mode) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &blk_check_mode) -> bool { !(*self).eq(other) } } @@ -1152,35 +851,6 @@ enum lit_ { } impl ast::lit_: cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &ast::lit_) -> bool { - match (self, *other) { - (lit_str(a), lit_str(b)) => a == b, - (lit_int(val_a, ty_a), lit_int(val_b, ty_b)) => { - val_a == val_b && ty_a == ty_b - } - (lit_uint(val_a, ty_a), lit_uint(val_b, ty_b)) => { - val_a == val_b && ty_a == ty_b - } - (lit_int_unsuffixed(a), lit_int_unsuffixed(b)) => a == b, - (lit_float(val_a, ty_a), lit_float(val_b, ty_b)) => { - val_a == val_b && ty_a == ty_b - } - (lit_float_unsuffixed(a), lit_float_unsuffixed(b)) => a == b, - (lit_nil, lit_nil) => true, - (lit_bool(a), lit_bool(b)) => a == b, - (lit_str(_), _) => false, - (lit_int(*), _) => false, - (lit_uint(*), _) => false, - (lit_int_unsuffixed(*), _) => false, - (lit_float(*), _) => false, - (lit_float_unsuffixed(*), _) => false, - (lit_nil, _) => false, - (lit_bool(_), _) => false - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &ast::lit_) -> bool { match ((*self), *other) { (lit_str(a), lit_str(b)) => a == b, @@ -1207,10 +877,6 @@ impl ast::lit_: cmp::Eq { (lit_bool(_), _) => false } } - #[cfg(stage0)] - pure fn ne(other: &ast::lit_) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &ast::lit_) -> bool { !(*self).eq(other) } } @@ -1253,25 +919,6 @@ impl int_ty : to_bytes::IterBytes { } impl int_ty : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &int_ty) -> bool { - match (self, (*other)) { - (ty_i, ty_i) => true, - (ty_char, ty_char) => true, - (ty_i8, ty_i8) => true, - (ty_i16, ty_i16) => true, - (ty_i32, ty_i32) => true, - (ty_i64, ty_i64) => true, - (ty_i, _) => false, - (ty_char, _) => false, - (ty_i8, _) => false, - (ty_i16, _) => false, - (ty_i32, _) => false, - (ty_i64, _) => false, - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &int_ty) -> bool { match ((*self), (*other)) { (ty_i, ty_i) => true, @@ -1288,10 +935,6 @@ impl int_ty : cmp::Eq { (ty_i64, _) => false, } } - #[cfg(stage0)] - pure fn ne(other: &int_ty) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &int_ty) -> bool { !(*self).eq(other) } } @@ -1306,23 +949,6 @@ impl uint_ty : to_bytes::IterBytes { } impl uint_ty : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &uint_ty) -> bool { - match (self, (*other)) { - (ty_u, ty_u) => true, - (ty_u8, ty_u8) => true, - (ty_u16, ty_u16) => true, - (ty_u32, ty_u32) => true, - (ty_u64, ty_u64) => true, - (ty_u, _) => false, - (ty_u8, _) => false, - (ty_u16, _) => false, - (ty_u32, _) => false, - (ty_u64, _) => false - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &uint_ty) -> bool { match ((*self), (*other)) { (ty_u, ty_u) => true, @@ -1337,10 +963,6 @@ impl uint_ty : cmp::Eq { (ty_u64, _) => false } } - #[cfg(stage0)] - pure fn ne(other: &uint_ty) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &uint_ty) -> bool { !(*self).eq(other) } } @@ -1354,25 +976,12 @@ impl float_ty : to_bytes::IterBytes { } } impl float_ty : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &float_ty) -> bool { - match (self, (*other)) { - (ty_f, ty_f) | (ty_f32, ty_f32) | (ty_f64, ty_f64) => true, - (ty_f, _) | (ty_f32, _) | (ty_f64, _) => false - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &float_ty) -> bool { match ((*self), (*other)) { (ty_f, ty_f) | (ty_f32, ty_f32) | (ty_f64, ty_f64) => true, (ty_f, _) | (ty_f32, _) | (ty_f64, _) => false } } - #[cfg(stage0)] - pure fn ne(other: &float_ty) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &float_ty) -> bool { !(*self).eq(other) } } @@ -1392,43 +1001,6 @@ enum prim_ty { } impl prim_ty : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &prim_ty) -> bool { - match self { - ty_int(e0a) => { - match (*other) { - ty_int(e0b) => e0a == e0b, - _ => false - } - } - ty_uint(e0a) => { - match (*other) { - ty_uint(e0b) => e0a == e0b, - _ => false - } - } - ty_float(e0a) => { - match (*other) { - ty_float(e0b) => e0a == e0b, - _ => false - } - } - ty_str => { - match (*other) { - ty_str => true, - _ => false - } - } - ty_bool => { - match (*other) { - ty_bool => true, - _ => false - } - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &prim_ty) -> bool { match (*self) { ty_int(e0a) => { @@ -1463,10 +1035,6 @@ impl prim_ty : cmp::Eq { } } } - #[cfg(stage0)] - pure fn ne(other: &prim_ty) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &prim_ty) -> bool { !(*self).eq(other) } } @@ -1491,27 +1059,12 @@ enum Onceness { } impl Onceness : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &Onceness) -> bool { - match (self, *other) { - (Once, Once) | (Many, Many) => true, - _ => false - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &Onceness) -> bool { match ((*self), *other) { (Once, Once) | (Many, Many) => true, _ => false } } - #[cfg(stage0)] - pure fn ne(other: &Onceness) -> bool { - !self.eq(other) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &Onceness) -> bool { !(*self).eq(other) } @@ -1553,21 +1106,9 @@ enum ty_ { // Equality and byte-iter (hashing) can be quite approximate for AST types. // since we only care about this for normalizing them to "real" types. impl Ty : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &Ty) -> bool { - ptr::addr_of(&self) == ptr::addr_of(&(*other)) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &Ty) -> bool { ptr::addr_of(&(*self)) == ptr::addr_of(&(*other)) } - #[cfg(stage0)] - pure fn ne(other: &Ty) -> bool { - ptr::addr_of(&self) != ptr::addr_of(&(*other)) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &Ty) -> bool { ptr::addr_of(&(*self)) != ptr::addr_of(&(*other)) } @@ -1607,19 +1148,9 @@ impl purity : to_bytes::IterBytes { } impl purity : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &purity) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &purity) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &purity) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &purity) -> bool { !(*self).eq(other) } } @@ -1638,17 +1169,6 @@ impl ret_style : to_bytes::IterBytes { } impl ret_style : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &ret_style) -> bool { - match (self, (*other)) { - (noreturn, noreturn) => true, - (return_val, return_val) => true, - (noreturn, _) => false, - (return_val, _) => false, - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &ret_style) -> bool { match ((*self), (*other)) { (noreturn, noreturn) => true, @@ -1657,10 +1177,6 @@ impl ret_style : cmp::Eq { (return_val, _) => false, } } - #[cfg(stage0)] - pure fn ne(other: &ret_style) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &ret_style) -> bool { !(*self).eq(other) } } @@ -1676,49 +1192,6 @@ enum self_ty_ { } impl self_ty_ : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &self_ty_) -> bool { - match self { - sty_static => { - match (*other) { - sty_static => true, - _ => false - } - } - sty_by_ref => { - match (*other) { - sty_by_ref => true, - _ => false - } - } - sty_value => { - match (*other) { - sty_value => true, - _ => false - } - } - sty_region(e0a) => { - match (*other) { - sty_region(e0b) => e0a == e0b, - _ => false - } - } - sty_box(e0a) => { - match (*other) { - sty_box(e0b) => e0a == e0b, - _ => false - } - } - sty_uniq(e0a) => { - match (*other) { - sty_uniq(e0b) => e0a == e0b, - _ => false - } - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &self_ty_) -> bool { match (*self) { sty_static => { @@ -1759,10 +1232,6 @@ impl self_ty_ : cmp::Eq { } } } - #[cfg(stage0)] - pure fn ne(other: &self_ty_) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &self_ty_) -> bool { !(*self).eq(other) } } @@ -1794,36 +1263,13 @@ enum foreign_abi { enum foreign_mod_sort { named, anonymous } impl foreign_mod_sort : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &foreign_mod_sort) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &foreign_mod_sort) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &foreign_mod_sort) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &foreign_mod_sort) -> bool { !(*self).eq(other) } } impl foreign_abi : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &foreign_abi) -> bool { - match (self, (*other)) { - (foreign_abi_rust_intrinsic, foreign_abi_rust_intrinsic) => true, - (foreign_abi_cdecl, foreign_abi_cdecl) => true, - (foreign_abi_stdcall, foreign_abi_stdcall) => true, - (foreign_abi_rust_intrinsic, _) => false, - (foreign_abi_cdecl, _) => false, - (foreign_abi_stdcall, _) => false, - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &foreign_abi) -> bool { match ((*self), (*other)) { (foreign_abi_rust_intrinsic, foreign_abi_rust_intrinsic) => true, @@ -1834,10 +1280,6 @@ impl foreign_abi : cmp::Eq { (foreign_abi_stdcall, _) => false, } } - #[cfg(stage0)] - pure fn ne(other: &foreign_abi) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &foreign_abi) -> bool { !(*self).eq(other) } } @@ -1886,19 +1328,9 @@ type path_list_ident = spanned; enum namespace { module_ns, type_value_ns } impl namespace : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &namespace) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &namespace) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &namespace) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &namespace) -> bool { !(*self).eq(other) } } @@ -1946,19 +1378,9 @@ type attribute = spanned; enum attr_style { attr_outer, attr_inner, } impl attr_style : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &attr_style) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &attr_style) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &attr_style) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &attr_style) -> bool { !(*self).eq(other) } } @@ -1985,19 +1407,6 @@ type trait_ref = {path: @path, ref_id: node_id, impl_id: node_id}; enum visibility { public, private, inherited } impl visibility : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &visibility) -> bool { - match (self, (*other)) { - (public, public) => true, - (private, private) => true, - (inherited, inherited) => true, - (public, _) => false, - (private, _) => false, - (inherited, _) => false, - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &visibility) -> bool { match ((*self), (*other)) { (public, public) => true, @@ -2008,10 +1417,6 @@ impl visibility : cmp::Eq { (inherited, _) => false, } } - #[cfg(stage0)] - pure fn ne(other: &visibility) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &visibility) -> bool { !(*self).eq(other) } } @@ -2033,30 +1438,6 @@ enum struct_field_kind { } impl struct_field_kind : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &struct_field_kind) -> bool { - match self { - named_field(ident_a, class_mutability_a, visibility_a) => { - match *other { - named_field(ident_b, class_mutability_b, visibility_b) - => { - ident_a == ident_b && - class_mutability_a == class_mutability_b && - visibility_a == visibility_b - } - unnamed_field => false - } - } - unnamed_field => { - match *other { - named_field(*) => false, - unnamed_field => true - } - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &struct_field_kind) -> bool { match (*self) { named_field(ident_a, class_mutability_a, visibility_a) => { @@ -2078,12 +1459,6 @@ impl struct_field_kind : cmp::Eq { } } } - #[cfg(stage0)] - pure fn ne(other: &struct_field_kind) -> bool { - !self.eq(other) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &struct_field_kind) -> bool { !(*self).eq(other) } @@ -2142,17 +1517,6 @@ impl class_mutability : to_bytes::IterBytes { } impl class_mutability : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &class_mutability) -> bool { - match (self, (*other)) { - (class_mutable, class_mutable) => true, - (class_immutable, class_immutable) => true, - (class_mutable, _) => false, - (class_immutable, _) => false, - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &class_mutability) -> bool { match ((*self), (*other)) { (class_mutable, class_mutable) => true, @@ -2161,10 +1525,6 @@ impl class_mutability : cmp::Eq { (class_immutable, _) => false, } } - #[cfg(stage0)] - pure fn ne(other: &class_mutability) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &class_mutability) -> bool { !(*self).eq(other) } } diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs index 859f5f1d502..3251ea5d2e9 100644 --- a/src/libsyntax/ast_map.rs +++ b/src/libsyntax/ast_map.rs @@ -12,25 +12,6 @@ enum path_elt { } impl path_elt : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &path_elt) -> bool { - match self { - path_mod(e0a) => { - match (*other) { - path_mod(e0b) => e0a == e0b, - _ => false - } - } - path_name(e0a) => { - match (*other) { - path_name(e0b) => e0a == e0b, - _ => false - } - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &path_elt) -> bool { match (*self) { path_mod(e0a) => { @@ -47,10 +28,6 @@ impl path_elt : cmp::Eq { } } } - #[cfg(stage0)] - pure fn ne(other: &path_elt) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &path_elt) -> bool { !(*self).eq(other) } } diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index 94d78d0c55f..468704c9aff 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -338,19 +338,9 @@ enum inline_attr { } impl inline_attr : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &inline_attr) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &inline_attr) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &inline_attr) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &inline_attr) -> bool { !(*self).eq(other) } } diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index fafcd09e3dc..2b77c805791 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -37,29 +37,11 @@ impl BytePos: Pos { pure fn to_uint(&self) -> uint { **self } } -#[cfg(stage0)] -impl BytePos: cmp::Eq { - pure fn eq(other: &BytePos) -> bool { *self == **other } - pure fn ne(other: &BytePos) -> bool { !self.eq(other) } -} - -#[cfg(stage1)] -#[cfg(stage2)] impl BytePos: cmp::Eq { pure fn eq(&self, other: &BytePos) -> bool { **self == **other } pure fn ne(&self, other: &BytePos) -> bool { !(*self).eq(other) } } -#[cfg(stage0)] -impl BytePos: cmp::Ord { - pure fn lt(other: &BytePos) -> bool { *self < **other } - pure fn le(other: &BytePos) -> bool { *self <= **other } - pure fn ge(other: &BytePos) -> bool { *self >= **other } - pure fn gt(other: &BytePos) -> bool { *self > **other } -} - -#[cfg(stage1)] -#[cfg(stage2)] impl BytePos: cmp::Ord { pure fn lt(&self, other: &BytePos) -> bool { **self < **other } pure fn le(&self, other: &BytePos) -> bool { **self <= **other } @@ -101,29 +83,11 @@ impl CharPos: Pos { pure fn to_uint(&self) -> uint { **self } } -#[cfg(stage0)] -impl CharPos: cmp::Eq { - pure fn eq(other: &CharPos) -> bool { *self == **other } - pure fn ne(other: &CharPos) -> bool { !self.eq(other) } -} - -#[cfg(stage1)] -#[cfg(stage2)] impl CharPos: cmp::Eq { pure fn eq(&self, other: &CharPos) -> bool { **self == **other } pure fn ne(&self, other: &CharPos) -> bool { !(*self).eq(other) } } -#[cfg(stage0)] -impl CharPos: cmp::Ord { - pure fn lt(other: &CharPos) -> bool { *self < **other } - pure fn le(other: &CharPos) -> bool { *self <= **other } - pure fn ge(other: &CharPos) -> bool { *self >= **other } - pure fn gt(other: &CharPos) -> bool { *self > **other } -} - -#[cfg(stage1)] -#[cfg(stage2)] impl CharPos: cmp::Ord { pure fn lt(&self, other: &CharPos) -> bool { **self < **other } pure fn le(&self, other: &CharPos) -> bool { **self <= **other } @@ -173,19 +137,9 @@ pub struct span { } impl span : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &span) -> bool { - return self.lo == (*other).lo && self.hi == (*other).hi; - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &span) -> bool { return (*self).lo == (*other).lo && (*self).hi == (*other).hi; } - #[cfg(stage0)] - pure fn ne(other: &span) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &span) -> bool { !(*self).eq(other) } } diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs index a362c766c77..8784b3837f1 100644 --- a/src/libsyntax/diagnostic.rs +++ b/src/libsyntax/diagnostic.rs @@ -149,19 +149,9 @@ enum level { } impl level : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &level) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &level) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &level) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &level) -> bool { !(*self).eq(other) } } diff --git a/src/libsyntax/ext/pipes/proto.rs b/src/libsyntax/ext/pipes/proto.rs index 23e18478536..18caef0f72f 100644 --- a/src/libsyntax/ext/pipes/proto.rs +++ b/src/libsyntax/ext/pipes/proto.rs @@ -6,17 +6,6 @@ use ast_builder::{path, append_types}; enum direction { send, recv } impl direction : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &direction) -> bool { - match (self, (*other)) { - (send, send) => true, - (recv, recv) => true, - (send, _) => false, - (recv, _) => false, - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &direction) -> bool { match ((*self), (*other)) { (send, send) => true, @@ -25,10 +14,6 @@ impl direction : cmp::Eq { (recv, _) => false, } } - #[cfg(stage0)] - pure fn ne(other: &direction) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &direction) -> bool { !(*self).eq(other) } } diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs index 3cb6b08d976..4f7bfb0d4e9 100644 --- a/src/libsyntax/parse/comments.rs +++ b/src/libsyntax/parse/comments.rs @@ -20,21 +20,9 @@ enum cmnt_style { } impl cmnt_style : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &cmnt_style) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &cmnt_style) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &cmnt_style) -> bool { - (self as uint) != ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &cmnt_style) -> bool { ((*self) as uint) != ((*other) as uint) } diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs index 40df4d5f7d4..4304c01fdb6 100644 --- a/src/libsyntax/parse/obsolete.rs +++ b/src/libsyntax/parse/obsolete.rs @@ -29,21 +29,9 @@ pub enum ObsoleteSyntax { } impl ObsoleteSyntax : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &ObsoleteSyntax) -> bool { - self as uint == (*other) as uint - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &ObsoleteSyntax) -> bool { (*self) as uint == (*other) as uint } - #[cfg(stage0)] - pure fn ne(other: &ObsoleteSyntax) -> bool { - !self.eq(other) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &ObsoleteSyntax) -> bool { !(*self).eq(other) } diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 382b572f33e..921fcfccc28 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -3747,19 +3747,9 @@ impl Parser { } impl restriction : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &restriction) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &restriction) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &restriction) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &restriction) -> bool { !(*self).eq(other) } } diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 2e59d2fa45f..3ee99c16e49 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -463,294 +463,13 @@ fn reserved_keyword_table() -> HashMap<~str, ()> { } impl binop : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &binop) -> bool { - (self as uint) == ((*other) as uint) - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &binop) -> bool { ((*self) as uint) == ((*other) as uint) } - #[cfg(stage0)] - pure fn ne(other: &binop) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &binop) -> bool { !(*self).eq(other) } } impl Token : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &Token) -> bool { - match self { - EQ => { - match (*other) { - EQ => true, - _ => false - } - } - LT => { - match (*other) { - LT => true, - _ => false - } - } - LE => { - match (*other) { - LE => true, - _ => false - } - } - EQEQ => { - match (*other) { - EQEQ => true, - _ => false - } - } - NE => { - match (*other) { - NE => true, - _ => false - } - } - GE => { - match (*other) { - GE => true, - _ => false - } - } - GT => { - match (*other) { - GT => true, - _ => false - } - } - ANDAND => { - match (*other) { - ANDAND => true, - _ => false - } - } - OROR => { - match (*other) { - OROR => true, - _ => false - } - } - NOT => { - match (*other) { - NOT => true, - _ => false - } - } - TILDE => { - match (*other) { - TILDE => true, - _ => false - } - } - BINOP(e0a) => { - match (*other) { - BINOP(e0b) => e0a == e0b, - _ => false - } - } - BINOPEQ(e0a) => { - match (*other) { - BINOPEQ(e0b) => e0a == e0b, - _ => false - } - } - AT => { - match (*other) { - AT => true, - _ => false - } - } - DOT => { - match (*other) { - DOT => true, - _ => false - } - } - DOTDOT => { - match (*other) { - DOTDOT => true, - _ => false - } - } - ELLIPSIS => { - match (*other) { - ELLIPSIS => true, - _ => false - } - } - COMMA => { - match (*other) { - COMMA => true, - _ => false - } - } - SEMI => { - match (*other) { - SEMI => true, - _ => false - } - } - COLON => { - match (*other) { - COLON => true, - _ => false - } - } - MOD_SEP => { - match (*other) { - MOD_SEP => true, - _ => false - } - } - RARROW => { - match (*other) { - RARROW => true, - _ => false - } - } - LARROW => { - match (*other) { - LARROW => true, - _ => false - } - } - DARROW => { - match (*other) { - DARROW => true, - _ => false - } - } - FAT_ARROW => { - match (*other) { - FAT_ARROW => true, - _ => false - } - } - LPAREN => { - match (*other) { - LPAREN => true, - _ => false - } - } - RPAREN => { - match (*other) { - RPAREN => true, - _ => false - } - } - LBRACKET => { - match (*other) { - LBRACKET => true, - _ => false - } - } - RBRACKET => { - match (*other) { - RBRACKET => true, - _ => false - } - } - LBRACE => { - match (*other) { - LBRACE => true, - _ => false - } - } - RBRACE => { - match (*other) { - RBRACE => true, - _ => false - } - } - POUND => { - match (*other) { - POUND => true, - _ => false - } - } - DOLLAR => { - match (*other) { - DOLLAR => true, - _ => false - } - } - LIT_INT(e0a, e1a) => { - match (*other) { - LIT_INT(e0b, e1b) => e0a == e0b && e1a == e1b, - _ => false - } - } - LIT_UINT(e0a, e1a) => { - match (*other) { - LIT_UINT(e0b, e1b) => e0a == e0b && e1a == e1b, - _ => false - } - } - LIT_INT_UNSUFFIXED(e0a) => { - match (*other) { - LIT_INT_UNSUFFIXED(e0b) => e0a == e0b, - _ => false - } - } - LIT_FLOAT(e0a, e1a) => { - match (*other) { - LIT_FLOAT(e0b, e1b) => e0a == e0b && e1a == e1b, - _ => false - } - } - LIT_FLOAT_UNSUFFIXED(e0a) => { - match (*other) { - LIT_FLOAT_UNSUFFIXED(e0b) => e0a == e0b, - _ => false - } - } - LIT_STR(e0a) => { - match (*other) { - LIT_STR(e0b) => e0a == e0b, - _ => false - } - } - IDENT(e0a, e1a) => { - match (*other) { - IDENT(e0b, e1b) => e0a == e0b && e1a == e1b, - _ => false - } - } - UNDERSCORE => { - match (*other) { - UNDERSCORE => true, - _ => false - } - } - INTERPOLATED(_) => { - match (*other) { - INTERPOLATED(_) => true, - _ => false - } - } - DOC_COMMENT(e0a) => { - match (*other) { - DOC_COMMENT(e0b) => e0a == e0b, - _ => false - } - } - EOF => { - match (*other) { - EOF => true, - _ => false - } - } - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &Token) -> bool { match (*self) { EQ => { @@ -1019,10 +738,6 @@ impl Token : cmp::Eq { } } } - #[cfg(stage0)] - pure fn ne(other: &Token) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &Token) -> bool { !(*self).eq(other) } } diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs index e4bd3e92cc4..014d564b84e 100644 --- a/src/libsyntax/print/pp.rs +++ b/src/libsyntax/print/pp.rs @@ -56,17 +56,6 @@ use dvec::DVec; enum breaks { consistent, inconsistent, } impl breaks : cmp::Eq { - #[cfg(stage0)] - pure fn eq(other: &breaks) -> bool { - match (self, (*other)) { - (consistent, consistent) => true, - (inconsistent, inconsistent) => true, - (consistent, _) => false, - (inconsistent, _) => false, - } - } - #[cfg(stage1)] - #[cfg(stage2)] pure fn eq(&self, other: &breaks) -> bool { match ((*self), (*other)) { (consistent, consistent) => true, @@ -75,10 +64,6 @@ impl breaks : cmp::Eq { (inconsistent, _) => false, } } - #[cfg(stage0)] - pure fn ne(other: &breaks) -> bool { !self.eq(other) } - #[cfg(stage1)] - #[cfg(stage2)] pure fn ne(&self, other: &breaks) -> bool { !(*self).eq(other) } } diff --git a/src/libsyntax/syntax.rc b/src/libsyntax/syntax.rc index afd961f22fc..d5a28a716ec 100644 --- a/src/libsyntax/syntax.rc +++ b/src/libsyntax/syntax.rc @@ -1,5 +1,3 @@ -// DIVERT - #[link(name = "syntax", vers = "0.5", uuid = "9311401b-d6ea-4cd9-a1d9-61f89499c645")]; @@ -42,116 +40,89 @@ mod fold; mod util { #[legacy_exports]; #[legacy_exports] + #[path = "util/interner.rs"] mod interner; } -mod parse { - #[legacy_exports]; - export parser; - export common; - export lexer; - export token; - export comments; - export prec; - export classify; - export attr; - - #[legacy_exports] - mod lexer; - #[legacy_exports] - mod parser; - #[legacy_exports] - mod token; - #[legacy_exports] - mod comments; - #[legacy_exports] - mod attr; - #[legacy_exports] - - /// Common routines shared by parser mods - #[legacy_exports] - mod common; - - /// Functions dealing with operator precedence - #[legacy_exports] - mod prec; - - /// Routines the parser uses to classify AST nodes - #[legacy_exports] - mod classify; - - /// Reporting obsolete syntax - #[legacy_exports] - mod obsolete; -} +#[merge = "parse/mod.rs"] +mod parse; mod print { #[legacy_exports]; #[legacy_exports] + #[path = "print/pp.rs"] mod pp; #[legacy_exports] + #[path = "print/pprust.rs"] mod pprust; } mod ext { #[legacy_exports]; #[legacy_exports] + #[path = "ext/base.rs"] mod base; #[legacy_exports] + #[path = "ext/expand.rs"] mod expand; #[legacy_exports] + #[path = "ext/qquote.rs"] mod qquote; + #[path = "ext/quote.rs"] mod quote; + #[path = "ext/deriving.rs"] mod deriving; #[legacy_exports] + #[path = "ext/build.rs"] mod build; mod tt { #[legacy_exports]; #[legacy_exports] + #[path = "ext/tt/transcribe.rs"] mod transcribe; #[legacy_exports] + #[path = "ext/tt/macro_parser.rs"] mod macro_parser; #[legacy_exports] + #[path = "ext/tt/macro_rules.rs"] mod macro_rules; } #[legacy_exports] + #[path = "ext/simplext.rs"] mod simplext; #[legacy_exports] + #[path = "ext/fmt.rs"] mod fmt; #[legacy_exports] + #[path = "ext/env.rs"] mod env; #[legacy_exports] + #[path = "ext/concat_idents.rs"] mod concat_idents; #[legacy_exports] + #[path = "ext/ident_to_str.rs"] mod ident_to_str; #[legacy_exports] + #[path = "ext/log_syntax.rs"] mod log_syntax; #[legacy_exports] + #[path = "ext/auto_serialize.rs"] mod auto_serialize; #[legacy_exports] + #[path = "ext/source_util.rs"] mod source_util; - mod pipes { - #[legacy_exports]; - #[legacy_exports] - mod ast_builder; - #[legacy_exports] - mod parse_proto; - #[legacy_exports] - mod pipec; - #[legacy_exports] - mod proto; - #[legacy_exports] - mod check; - #[legacy_exports] - mod liveness; - } + #[legacy_exports] + #[path = "ext/pipes.rs"] + #[merge = "ext/pipes/mod.rs"] + mod pipes; #[legacy_exports] + #[path = "ext/trace_macros.rs"] mod trace_macros; } diff --git a/src/snapshots.txt b/src/snapshots.txt index cbe594a74e7..cf216fe923c 100644 --- a/src/snapshots.txt +++ b/src/snapshots.txt @@ -1,3 +1,11 @@ +S 2012-11-26 be6613e + winnt-i386 f800925ce98d23f842a03be65f01aae0dfa1e897 + freebsd-x86_64 23462b234b8ff3c0b6d6f94e5952178dbcef3488 + linux-i386 e5fc408495952b61c3c103265cf1f54e2ab51e05 + linux-x86_64 beb6454c57267c9fb198e4f0f8d4773e28f5bdf4 + macos-i386 46b83a3fec0731198e010827c6842f2854cc79df + macos-x86_64 d06b16853e2a81fa5edb7fb2de73e6665c1ccd28 + S 2012-11-18 68c73dc freebsd-x86_64 976e75614c455557e3763e270cbf7b5fce1c5c67 linux-i386 d44088ce7183622921626038becf9c5e2d76cb66