Merge remote-tracking branch 'brson/companion' into incoming

Conflicts:
	src/compiletest/compiletest.rs
	src/libcargo/cargo.rs
	src/libcore/core.rs
	src/librustc/rustc.rs
	src/librustdoc/rustdoc.rc
This commit is contained in:
Brian Anderson 2012-11-28 12:38:53 -08:00
commit fc06114ddf
150 changed files with 4316 additions and 8444 deletions

View file

@ -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) }
}

View file

@ -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) }
}

View file

@ -0,0 +1,5 @@
#[legacy_exports];
#[legacy_exports]
mod driver;
#[legacy_exports]
mod session;

View file

@ -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) }
}
@ -357,7 +327,6 @@ mod test {
if with_bin { attrs += ~[make_crate_type_attr(~"bin")]; }
if with_lib { attrs += ~[make_crate_type_attr(~"lib")]; }
@ast_util::respan(ast_util::dummy_sp(), {
directives: ~[],
module: {view_items: ~[], items: ~[]},
attrs: attrs,
config: ~[]

View file

@ -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) }
}

View file

@ -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) }
}

View file

@ -0,0 +1,32 @@
#[legacy_exports];
export encoder;
export creader;
export cstore;
export csearch;
export common;
export decoder;
export tyencode;
export tydecode;
export loader;
export filesearch;
#[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;

View file

@ -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<T:Copy,U>(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))
}

View file

@ -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) }
}

View file

@ -0,0 +1,9 @@
#[legacy_exports];
#[legacy_exports]
mod check_loans;
#[legacy_exports]
mod gather_loans;
#[legacy_exports]
mod loan;
#[legacy_exports]
mod preserve;

View file

@ -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) }
}

View file

@ -207,20 +207,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,
@ -232,10 +218,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) }
}

View file

@ -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) }
}

View file

@ -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) }
}

View file

@ -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) }
}

View file

@ -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());
}

View file

@ -374,21 +374,10 @@ type region_dep = {ambient_variance: region_variance, id: ast::node_id};
type dep_map = HashMap<ast::node_id, @DVec<region_dep>>;
impl region_dep : cmp::Eq {
#[cfg(stage0)]
pure fn eq(other: &region_dep) -> bool {
self.ambient_variance == (*other).ambient_variance &&
self.id == (*other).id
}
#[cfg(stage1)]
#[cfg(stage2)]
pure fn eq(&self, other: &region_dep) -> bool {
(*self).ambient_variance == (*other).ambient_variance &&
(*self).id == (*other).id
}
#[cfg(stage0)]
pure fn ne(other: &region_dep) -> bool { !self.eq(other) }
#[cfg(stage1)]
#[cfg(stage2)]
pure fn ne(&self, other: &region_dep) -> bool { !(*self).eq(other) }
}

View file

@ -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) }
}

View file

@ -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) }
}

View file

@ -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) }
}

View file

@ -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) }
}
@ -817,17 +807,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,
@ -836,9 +815,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) }
}

View file

@ -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) }
}
@ -1445,23 +1430,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,
@ -1476,10 +1444,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) }
}

View file

@ -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) }
}

View file

@ -245,25 +245,11 @@ type creader_cache_key = {cnum: int, pos: uint, len: uint};
type creader_cache = HashMap<creader_cache_key, t>;
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))
}
@ -286,19 +272,9 @@ impl creader_cache_key : to_bytes::IterBytes {
type intern_key = {sty: sty, o_def_id: Option<ast::def_id>};
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) }
}
@ -328,19 +304,6 @@ type opt_region_variance = Option<region_variance>;
enum region_variance { rv_covariant, rv_invariant, rv_contravariant }
impl region_variance : cmp::Eq {
#[cfg(stage0)]
pure fn eq(other: &region_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: &region_variance) -> bool {
match ((*self), (*other)) {
(rv_covariant, rv_covariant) => true,
@ -351,10 +314,6 @@ impl region_variance : cmp::Eq {
(rv_contravariant, _) => false
}
}
#[cfg(stage0)]
pure fn ne(other: &region_variance) -> bool { !self.eq(other) }
#[cfg(stage1)]
#[cfg(stage2)]
pure fn ne(&self, other: &region_variance) -> bool { !(*self).eq(other) }
}
@ -563,19 +522,9 @@ type FnTy = FnTyBase<FnMeta>;
type param_ty = {idx: uint, def_id: def_id};
impl param_ty : cmp::Eq {
#[cfg(stage0)]
pure fn eq(other: &param_ty) -> bool {
self.idx == (*other).idx && self.def_id == (*other).def_id
}
#[cfg(stage1)]
#[cfg(stage2)]
pure fn eq(&self, other: &param_ty) -> bool {
(*self).idx == (*other).idx && (*self).def_id == (*other).def_id
}
#[cfg(stage0)]
pure fn ne(other: &param_ty) -> bool { !self.eq(other) }
#[cfg(stage1)]
#[cfg(stage2)]
pure fn ne(&self, other: &param_ty) -> bool { !(*self).eq(other) }
}
@ -823,20 +772,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)) => {
@ -848,12 +783,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))
}
@ -4579,88 +4508,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) => {
@ -4689,175 +4557,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<M: cmp::Eq> FnTyBase<M> : cmp::Eq {
#[cfg(stage0)]
pure fn eq(other: &FnTyBase<M>) -> bool {
self.meta == (*other).meta && self.sig == (*other).sig
}
#[cfg(stage1)]
#[cfg(stage2)]
pure fn eq(&self, other: &FnTyBase<M>) -> bool {
(*self).meta == (*other).meta && (*self).sig == (*other).sig
}
#[cfg(stage0)]
pure fn ne(other: &FnTyBase<M>) -> bool { !self.eq(other) }
#[cfg(stage1)]
#[cfg(stage2)]
pure fn ne(&self, other: &FnTyBase<M>) -> 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) => {
@ -4892,45 +4645,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 => {
@ -4959,216 +4677,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 => {
@ -5330,51 +4858,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: &param_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: &param_bound) -> bool {
match (*self) {
bound_copy => {
@ -5409,23 +4896,11 @@ impl param_bound : cmp::Eq {
}
}
}
#[cfg(stage0)]
pure fn ne(other: &param_bound) -> bool { !self.eq(other) }
#[cfg(stage1)]
#[cfg(stage2)]
pure fn ne(&self, other: &param_bound) -> bool { !(*self).eq(other) }
pure fn ne(&self, other: &param_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) }
}

View file

@ -0,0 +1,14 @@
#[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;

View file

@ -0,0 +1,24 @@
#[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;

View file

@ -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) }
}
@ -549,19 +526,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) }
}
@ -1093,38 +1060,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) }
}

View file

@ -0,0 +1,16 @@
#[legacy_exports];
#[legacy_exports]
#[merge = "check/mod.rs"]
pub mod check;
#[legacy_exports]
mod rscope;
#[legacy_exports]
mod astconv;
#[merge = "infer/mod.rs"]
mod infer;
#[legacy_exports]
mod collect;
#[legacy_exports]
mod coherence;
mod deriving;

View file

@ -43,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 <foo> Warn about <foo>
-A <foo> Allow <foo>
-D <foo> Deny <foo>
-F <foo> Forbid <foo> (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::<pp_mode>(ppm) => {
pretty_print_input(sess, cfg, input, ppm);
return;
}
None::<pp_mode> => {/* 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<monitor_msg>,
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

View file

@ -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 <foo> Warn about <foo>
-A <foo> Allow <foo>
-D <foo> Deny <foo>
-F <foo> Forbid <foo> (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::<pp_mode>(ppm) => {
pretty_print_input(sess, cfg, input, ppm);
return;
}
None::<pp_mode> => {/* 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<monitor_msg>,
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: