rustc: Add an "ne" method to the Eq trait, and implement it everywhere

This commit is contained in:
Patrick Walton 2012-09-07 12:06:02 -07:00
parent ac1f84c153
commit feb014eb3c
76 changed files with 218 additions and 60 deletions

View File

@ -100,6 +100,7 @@ impl mode : cmp::Eq {
pure fn eq(&&other: mode) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: mode) -> bool { !self.eq(other) }
}
fn opts() -> ~[getopts::Opt] {

View File

@ -6,6 +6,7 @@ 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) }
}
type config = {

View File

@ -12,6 +12,7 @@ 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) }
}
fn write_file(filename: &Path, content: ~str) {

View File

@ -70,9 +70,8 @@ fn all_values(blk: fn(v: bool)) {
pure fn to_bit(v: bool) -> u8 { if v { 1u8 } else { 0u8 } }
impl bool : cmp::Eq {
pure fn eq(&&other: bool) -> bool {
self == other
}
pure fn eq(&&other: bool) -> bool { self == other }
pure fn ne(&&other: bool) -> bool { self != other }
}
#[test]

View File

@ -15,6 +15,7 @@ pure fn ptr_eq<T>(a: @T, b: @T) -> bool {
impl<T:Eq> @const T : Eq {
pure fn eq(&&other: @const T) -> bool { *self == *other }
pure fn ne(&&other: @const T) -> bool { *self != *other }
}
impl<T:Ord> @const T : Ord {

View File

@ -191,6 +191,7 @@ pure fn cmp(a: char, b: char) -> int {
impl char: Eq {
pure fn eq(&&other: char) -> bool { self == other }
pure fn ne(&&other: char) -> bool { self != other }
}
#[test]

View File

@ -26,11 +26,13 @@ trait Ord {
#[lang="eq"]
trait Eq {
pure fn eq(&&other: self) -> bool;
pure fn ne(&&other: self) -> bool;
}
#[cfg(test)]
trait Eq {
pure fn eq(&&other: self) -> bool;
pure fn ne(&&other: self) -> bool;
}
pure fn lt<T: Ord>(v1: &T, v2: &T) -> bool {
@ -45,6 +47,10 @@ pure fn eq<T: Eq>(v1: &T, v2: &T) -> bool {
v1.eq(v2)
}
pure fn ne<T: Eq>(v1: &T, v2: &T) -> bool {
v1.ne(v2)
}
pure fn ge<T: Ord>(v1: &T, v2: &T) -> bool {
v1.ge(v2)
}

View File

@ -143,6 +143,7 @@ impl<T:Eq,U:Eq> Either<T,U> : Eq {
}
}
}
pure fn ne(&&other: Either<T,U>) -> bool { !self.eq(other) }
}
#[test]

View File

@ -401,6 +401,7 @@ mod rt {
(pad_float, _) => false
}
}
pure fn ne(&&other: pad_mode) -> bool { !self.eq(other) }
}
fn pad(cv: conv, &s: ~str, mode: pad_mode) -> ~str {

View File

@ -416,6 +416,7 @@ pure fn tan(x: float) -> float { f64::tan(x as f64) as float }
impl float: Eq {
pure fn eq(&&other: float) -> bool { self == other }
pure fn ne(&&other: float) -> bool { self != other }
}
impl float: Ord {

View File

@ -76,9 +76,8 @@ impl T: Ord {
}
impl T: Eq {
pure fn eq(&&other: T) -> bool {
return self == other;
}
pure fn eq(&&other: T) -> bool { return self == other; }
pure fn ne(&&other: T) -> bool { return self != other; }
}
impl T: num::Num {

View File

@ -337,6 +337,7 @@ impl WriterType: Eq {
(Screen, _) | (File, _) => false
}
}
pure fn ne(&&other: WriterType) -> bool { !self.eq(other) }
}
// FIXME (#2004): Seekable really should be orthogonal.

View File

@ -266,6 +266,7 @@ impl<T: Eq> Option<T> : Eq {
}
}
}
pure fn ne(&&other: Option<T>) -> bool { !self.eq(other) }
}
#[test]

View File

@ -69,6 +69,7 @@ impl PosixPath : Eq {
return self.is_absolute == other.is_absolute &&
self.components == other.components;
}
pure fn ne(&&other: PosixPath) -> bool { !self.eq(other) }
}
impl WindowsPath : Eq {
@ -78,6 +79,7 @@ impl WindowsPath : Eq {
self.is_absolute == other.is_absolute &&
self.components == other.components;
}
pure fn ne(&&other: WindowsPath) -> bool { !self.eq(other) }
}
// FIXME (#3227): when default methods in traits are working, de-duplicate

View File

@ -128,6 +128,7 @@ impl State: Eq {
pure fn eq(&&other: State) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: State) -> bool { !self.eq(other) }
}
struct BufferHeader {

View File

@ -188,6 +188,7 @@ impl<T> *const T : Eq {
let b: uint = unsafe::reinterpret_cast(&other);
return a == b;
}
pure fn ne(&&other: *const T) -> bool { !self.eq(other) }
}
// Comparison for pointers
@ -216,9 +217,8 @@ impl<T> *const T : Ord {
// Equality for region pointers
impl<T:Eq> &const T : Eq {
pure fn eq(&&other: &const T) -> bool {
return *self == *other;
}
pure fn eq(&&other: &const T) -> bool { return *self == *other; }
pure fn ne(&&other: &const T) -> bool { return *self != *other; }
}
// Comparison for region pointers

View File

@ -373,6 +373,7 @@ impl<T:Eq,U:Eq> Result<T,U> : Eq {
}
}
}
pure fn ne(&&other: Result<T,U>) -> bool { !self.eq(other) }
}
#[cfg(test)]

View File

@ -780,6 +780,8 @@ impl &str: Eq {
pure fn eq(&&other: &str) -> bool {
eq_slice(self, other)
}
#[inline(always)]
pure fn ne(&&other: &str) -> bool { !self.eq(other) }
}
impl ~str: Eq {
@ -787,6 +789,8 @@ impl ~str: Eq {
pure fn eq(&&other: ~str) -> bool {
eq_slice(self, other)
}
#[inline(always)]
pure fn ne(&&other: ~str) -> bool { !self.eq(other) }
}
impl @str: Eq {
@ -794,6 +798,8 @@ impl @str: Eq {
pure fn eq(&&other: @str) -> bool {
eq_slice(self, other)
}
#[inline(always)]
pure fn ne(&&other: @str) -> bool { !self.eq(other) }
}
impl ~str : Ord {

View File

@ -85,9 +85,8 @@ enum Task {
}
impl Task : cmp::Eq {
pure fn eq(&&other: Task) -> bool {
*self == *other
}
pure fn eq(&&other: Task) -> bool { *self == *other }
pure fn ne(&&other: Task) -> bool { !self.eq(other) }
}
/**
@ -113,6 +112,7 @@ impl TaskResult: Eq {
(Success, _) | (Failure, _) => false
}
}
pure fn ne(&&other: TaskResult) -> bool { !self.eq(other) }
}
/// A message type for notifying of task lifecycle events
@ -131,6 +131,7 @@ impl Notification : cmp::Eq {
}
}
}
pure fn ne(&&other: Notification) -> bool { !self.eq(other) }
}
/// Scheduler modes
@ -1324,6 +1325,7 @@ impl LocalData: Eq {
let ptr_b: (uint, uint) = unsafe::reinterpret_cast(&other);
return ptr_a == ptr_b;
}
pure fn ne(&&other: LocalData) -> bool { !self.eq(other) }
}
// We use dvec because it's the best data structure in core. If TLS is used

View File

@ -81,6 +81,7 @@ impl<A: Eq, B: Eq> (A, B): Eq {
}
}
}
pure fn ne(&&other: (A, B)) -> bool { !self.eq(other) }
}
impl<A: Ord, B: Ord> (A, B): Ord {
@ -119,6 +120,7 @@ impl<A: Eq, B: Eq, C: Eq> (A, B, C): Eq {
}
}
}
pure fn ne(&&other: (A, B, C)) -> bool { !self.eq(other) }
}
impl<A: Ord, B: Ord, C: Ord> (A, B, C): Ord {

View File

@ -69,9 +69,8 @@ impl T: Ord {
}
impl T: Eq {
pure fn eq(&&other: T) -> bool {
return self == other;
}
pure fn eq(&&other: T) -> bool { return self == other; }
pure fn ne(&&other: T) -> bool { return self != other; }
}
impl T: num::Num {

View File

@ -4,6 +4,7 @@ use cmp::{Eq, Ord};
impl<T:Eq> ~const T : Eq {
pure fn eq(&&other: ~const T) -> bool { *self == *other }
pure fn ne(&&other: ~const T) -> bool { *self != *other }
}
impl<T:Ord> ~const T : Ord {

View File

@ -6,6 +6,7 @@ use cmp::{Eq, Ord};
impl () : Eq {
pure fn eq(&&_other: ()) -> bool { true }
pure fn ne(&&_other: ()) -> bool { false }
}
impl () : Ord {

View File

@ -1406,23 +1406,23 @@ pure fn eq<T: Eq>(a: &[T], b: &[T]) -> bool {
impl<T: Eq> &[T]: Eq {
#[inline(always)]
pure fn eq(&&other: &[T]) -> bool {
eq(self, other)
}
pure fn eq(&&other: &[T]) -> bool { eq(self, other) }
#[inline(always)]
pure fn ne(&&other: &[T]) -> bool { !self.eq(other) }
}
impl<T: Eq> ~[T]: Eq {
#[inline(always)]
pure fn eq(&&other: ~[T]) -> bool {
eq(self, other)
}
pure fn eq(&&other: ~[T]) -> bool { eq(self, other) }
#[inline(always)]
pure fn ne(&&other: ~[T]) -> bool { !self.eq(other) }
}
impl<T: Eq> @[T]: Eq {
#[inline(always)]
pure fn eq(&&other: @[T]) -> bool {
eq(self, other)
}
pure fn eq(&&other: @[T]) -> bool { eq(self, other) }
#[inline(always)]
pure fn ne(&&other: @[T]) -> bool { !self.eq(other) }
}
// Lexicographical comparison

View File

@ -124,12 +124,14 @@ impl Name : Eq {
}
}
}
pure fn ne(&&other: Name) -> bool { !self.eq(other) }
}
impl Occur : Eq {
pure fn eq(&&other: Occur) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: Occur) -> bool { !self.eq(other) }
}
/// Create an option that is required and takes an argument
@ -449,6 +451,7 @@ impl FailType : Eq {
pure fn eq(&&other: FailType) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: FailType) -> bool { !self.eq(other) }
}
#[cfg(test)]

View File

@ -609,12 +609,12 @@ impl Error : Eq {
self.col == other.col &&
self.msg == other.msg
}
pure fn ne(&&other: Error) -> bool { !self.eq(other) }
}
impl Json : Eq {
pure fn eq(&&other: Json) -> bool {
eq(self, other)
}
pure fn eq(&&other: Json) -> bool { eq(self, other) }
pure fn ne(&&other: Json) -> bool { !self.eq(other) }
}
trait ToJson { fn to_json() -> Json; }

View File

@ -165,6 +165,7 @@ impl<T:Eq> List<T> : Eq {
}
}
}
pure fn ne(&&other: List<T>) -> bool { !self.eq(other) }
}
#[cfg(test)]

View File

@ -320,6 +320,7 @@ impl UserInfo : Eq {
pure fn eq(&&other: UserInfo) -> bool {
self.user == other.user && self.pass == other.pass
}
pure fn ne(&&other: UserInfo) -> bool { !self.eq(other) }
}
fn query_from_str(rawquery: &str) -> Query {
@ -386,6 +387,7 @@ impl Input: Eq {
(Unreserved, _) => false
}
}
pure fn ne(&&other: Input) -> bool { !self.eq(other) }
}
// returns userinfo, host, port, and unparsed part, or an error

View File

@ -96,6 +96,7 @@ impl TestResult : Eq {
pure fn eq(&&other: TestResult) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: TestResult) -> bool { !self.eq(other) }
}
type ConsoleTestState =

View File

@ -40,6 +40,7 @@ impl Timespec : Eq {
pure fn eq(&&other: Timespec) -> bool {
self.sec == other.sec && self.nsec == other.nsec
}
pure fn ne(&&other: Timespec) -> bool { !self.eq(other) }
}
/**
@ -105,6 +106,7 @@ impl Tm_ : Eq {
self.tm_zone == other.tm_zone &&
self.tm_nsec == other.tm_nsec
}
pure fn ne(&&other: Tm_) -> bool { !self.eq(other) }
}
enum Tm {
@ -112,9 +114,8 @@ enum Tm {
}
impl Tm : Eq {
pure fn eq(&&other: Tm) -> bool {
*self == *other
}
pure fn eq(&&other: Tm) -> bool { *self == *other }
pure fn ne(&&other: Tm) -> bool { *self != *other }
}
fn empty_tm() -> Tm {

View File

@ -81,6 +81,7 @@ impl def_id: cmp::Eq {
pure fn eq(&&other: def_id) -> bool {
self.crate == other.crate && self.node == other.node
}
pure fn ne(&&other: def_id) -> bool { !self.eq(other) }
}
const local_crate: crate_num = 0;
@ -244,6 +245,7 @@ impl def : cmp::Eq {
}
}
}
pure fn ne(&&other: def) -> bool { !self.eq(other) }
}
// The set of meta_items that define the compilation environment of the crate,
@ -337,6 +339,7 @@ impl binding_mode : cmp::Eq {
}
}
}
pure fn ne(&&other: binding_mode) -> bool { !self.eq(other) }
}
#[auto_serialize]
@ -368,6 +371,7 @@ impl mutability: cmp::Eq {
pure fn eq(&&other: mutability) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: mutability) -> bool { !self.eq(other) }
}
#[auto_serialize]
@ -420,6 +424,7 @@ impl binop : cmp::Eq {
pure fn eq(&&other: binop) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: binop) -> bool { !self.eq(other) }
}
#[auto_serialize]
@ -454,6 +459,7 @@ impl<T:cmp::Eq> inferable<T> : cmp::Eq {
}
}
}
pure fn ne(&&other: inferable<T>) -> bool { !self.eq(other) }
}
// "resolved" mode: the real modes.
@ -464,6 +470,7 @@ impl rmode : cmp::Eq {
pure fn eq(&&other: rmode) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: rmode) -> bool { !self.eq(other) }
}
// inferable mode.
@ -504,6 +511,7 @@ impl init_op : cmp::Eq {
}
}
}
pure fn ne(&&other: init_op) -> bool { !self.eq(other) }
}
#[auto_serialize]
@ -547,6 +555,7 @@ impl blk_check_mode : cmp::Eq {
(unsafe_blk, _) => false,
}
}
pure fn ne(&&other: blk_check_mode) -> bool { !self.eq(other) }
}
#[auto_serialize]
@ -781,6 +790,7 @@ impl ast::lit_: cmp::Eq {
(lit_bool(_), _) => false
}
}
pure fn ne(&&other: ast::lit_) -> bool { !self.eq(other) }
}
// NB: If you change this, you'll probably want to change the corresponding
@ -828,6 +838,7 @@ impl int_ty: cmp::Eq {
(ty_i64, _) => false,
}
}
pure fn ne(&&other: int_ty) -> bool { !self.eq(other) }
}
#[auto_serialize]
@ -848,6 +859,7 @@ impl uint_ty: cmp::Eq {
(ty_u64, _) => false
}
}
pure fn ne(&&other: uint_ty) -> bool { !self.eq(other) }
}
#[auto_serialize]
@ -860,6 +872,7 @@ impl float_ty: cmp::Eq {
(ty_f, _) | (ty_f32, _) | (ty_f64, _) => false
}
}
pure fn ne(&&other: float_ty) -> bool { !self.eq(other) }
}
#[auto_serialize]
@ -910,6 +923,7 @@ impl prim_ty : cmp::Eq {
}
}
}
pure fn ne(&&other: prim_ty) -> bool { !self.eq(other) }
}
#[auto_serialize]
@ -960,6 +974,7 @@ impl purity : cmp::Eq {
pure fn eq(&&other: purity) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: purity) -> bool { !self.eq(other) }
}
#[auto_serialize]
@ -978,6 +993,7 @@ impl ret_style : cmp::Eq {
(return_val, _) => false,
}
}
pure fn ne(&&other: ret_style) -> bool { !self.eq(other) }
}
#[auto_serialize]
@ -1031,6 +1047,7 @@ impl self_ty_ : cmp::Eq {
}
}
}
pure fn ne(&&other: self_ty_) -> bool { !self.eq(other) }
}
#[auto_serialize]
@ -1061,6 +1078,7 @@ impl foreign_mod_sort : cmp::Eq {
pure fn eq(&&other: foreign_mod_sort) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: foreign_mod_sort) -> bool { !self.eq(other) }
}
impl foreign_abi : cmp::Eq {
@ -1074,6 +1092,7 @@ impl foreign_abi : cmp::Eq {
(foreign_abi_stdcall, _) => false,
}
}
pure fn ne(&&other: foreign_abi) -> bool { !self.eq(other) }
}
#[auto_serialize]
@ -1115,6 +1134,7 @@ impl namespace : cmp::Eq {
pure fn eq(&&other: namespace) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: namespace) -> bool { !self.eq(other) }
}
#[auto_serialize]
@ -1162,6 +1182,7 @@ impl attr_style : cmp::Eq {
pure fn eq(&&other: attr_style) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: attr_style) -> bool { !self.eq(other) }
}
// doc-comments are promoted to attributes that have is_sugared_doc = true
@ -1194,6 +1215,7 @@ impl visibility : cmp::Eq {
(inherited, _) => false,
}
}
pure fn ne(&&other: visibility) -> bool { !self.eq(other) }
}
#[auto_serialize]
@ -1262,6 +1284,7 @@ impl class_mutability : cmp::Eq {
(class_immutable, _) => false,
}
}
pure fn ne(&&other: class_mutability) -> bool { !self.eq(other) }
}
#[auto_serialize]

View File

@ -28,6 +28,7 @@ impl path_elt : cmp::Eq {
}
}
}
pure fn ne(&&other: path_elt) -> bool { !self.eq(other) }
}
type path = ~[path_elt];

View File

@ -36,6 +36,7 @@ impl file_pos: cmp::Eq {
pure fn eq(&&other: file_pos) -> bool {
self.ch == other.ch && self.byte == other.byte
}
pure fn ne(&&other: file_pos) -> bool { !self.eq(other) }
}
/* A codemap is a thing that maps uints to file/line/column positions
@ -174,6 +175,7 @@ impl span : cmp::Eq {
pure fn eq(&&other: span) -> bool {
return self.lo == other.lo && self.hi == other.hi;
}
pure fn ne(&&other: span) -> bool { !self.eq(other) }
}
fn span_to_str_no_adj(sp: span, cm: codemap) -> ~str {

View File

@ -150,6 +150,7 @@ impl level : cmp::Eq {
pure fn eq(&&other: level) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: level) -> bool { !self.eq(other) }
}
fn diagnosticstr(lvl: level) -> ~str {

View File

@ -14,6 +14,7 @@ impl direction : cmp::Eq {
(recv, _) => false,
}
}
pure fn ne(&&other: direction) -> bool { !self.eq(other) }
}
impl direction: ToStr {

View File

@ -3626,6 +3626,7 @@ impl restriction : cmp::Eq {
pure fn eq(&&other: restriction) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: restriction) -> bool { !self.eq(other) }
}
//

View File

@ -440,6 +440,7 @@ impl binop : cmp::Eq {
pure fn eq(&&other: binop) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: binop) -> bool { !self.eq(other) }
}
impl token : cmp::Eq {
@ -705,6 +706,7 @@ impl token : cmp::Eq {
}
}
}
pure fn ne(&&other: token) -> bool { !self.eq(other) }
}
// Local Variables:

View File

@ -64,6 +64,7 @@ impl breaks : cmp::Eq {
(inconsistent, _) => false,
}
}
pure fn ne(&&other: breaks) -> bool { !self.eq(other) }
}
type break_t = {offset: int, blank_space: int};

View File

@ -30,6 +30,7 @@ impl output_type : cmp::Eq {
pure fn eq(&&other: output_type) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: output_type) -> bool { !self.eq(other) }
}
fn llvm_err(sess: session, msg: ~str) -> ! unsafe {

View File

@ -140,6 +140,7 @@ impl compile_upto : cmp::Eq {
pure fn eq(&&other: compile_upto) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: compile_upto) -> bool { !self.eq(other) }
}
fn compile_upto(sess: session, cfg: ast::crate_cfg,

View File

@ -209,6 +209,7 @@ impl monitor_msg : cmp::Eq {
pure fn eq(&&other: monitor_msg) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: monitor_msg) -> bool { !self.eq(other) }
}
/*

View File

@ -16,6 +16,7 @@ impl os : cmp::Eq {
pure fn eq(&&other: os) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: os) -> bool { !self.eq(other) }
}
enum arch { arch_x86, arch_x86_64, arch_arm, }
@ -24,6 +25,7 @@ impl arch: cmp::Eq {
pure fn eq(&&other: arch) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: arch) -> bool { !self.eq(other) }
}
enum crate_type { bin_crate, lib_crate, unknown_crate, }
@ -95,6 +97,7 @@ impl OptLevel : cmp::Eq {
pure fn eq(&&other: OptLevel) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: OptLevel) -> bool { !self.eq(other) }
}
type options =

View File

@ -165,6 +165,7 @@ impl TypeKind : cmp::Eq {
(X86_MMX, _) => false,
}
}
pure fn ne(&&other: TypeKind) -> bool { !self.eq(other) }
}
enum AtomicBinOp {

View File

@ -133,6 +133,7 @@ impl Family : cmp::Eq {
pure fn eq(&&other: Family) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: Family) -> bool { !self.eq(other) }
}
fn item_family(item: ebml::Doc) -> Family {

View File

@ -365,6 +365,7 @@ impl bckerr_code : cmp::Eq {
}
}
}
pure fn ne(&&other: bckerr_code) -> bool { !self.eq(other) }
}
// Combination of an error code and the categorization of the expression
@ -375,6 +376,7 @@ impl bckerr : cmp::Eq {
pure fn eq(&&other: bckerr) -> bool {
self.cmt == other.cmt && self.code == other.code
}
pure fn ne(&&other: bckerr) -> bool { !self.eq(other) }
}
// shorthand for something that fails with `bckerr` or succeeds with `T`

View File

@ -53,6 +53,7 @@ impl purity_cause : cmp::Eq {
}
}
}
pure fn ne(&&other: purity_cause) -> bool { !self.eq(other) }
}
fn check_loans(bccx: borrowck_ctxt,

View File

@ -138,6 +138,7 @@ impl ctor: cmp::Eq {
}
}
}
pure fn ne(&&other: ctor) -> bool { !self.eq(other) }
}
// Algorithm from http://moscova.inria.fr/~maranget/papers/warn/index.html

View File

@ -201,6 +201,7 @@ impl const_val: cmp::Eq {
(const_str(_), _) | (const_bool(_), _) => false
}
}
pure fn ne(&&other: const_val) -> bool { !self.eq(other) }
}
// FIXME: issue #1417

View File

@ -68,6 +68,7 @@ impl lint : cmp::Eq {
pure fn eq(&&other: lint) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: lint) -> bool { !self.eq(other) }
}
fn level_to_str(lv: level) -> ~str {
@ -87,6 +88,7 @@ impl level : cmp::Eq {
pure fn eq(&&other: level) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: level) -> bool { !self.eq(other) }
}
type lint_spec = @{lint: lint,

View File

@ -128,15 +128,13 @@ enum Variable = uint;
enum LiveNode = uint;
impl Variable : cmp::Eq {
pure fn eq(&&other: Variable) -> bool {
*self == *other
}
pure fn eq(&&other: Variable) -> bool { *self == *other }
pure fn ne(&&other: Variable) -> bool { *self != *other }
}
impl LiveNode : cmp::Eq {
pure fn eq(&&other: LiveNode) -> bool {
*self == *other
}
pure fn eq(&&other: LiveNode) -> bool { *self == *other }
pure fn ne(&&other: LiveNode) -> bool { *self != *other }
}
enum LiveNodeKind {
@ -175,6 +173,7 @@ impl LiveNodeKind : cmp::Eq {
}
}
}
pure fn ne(&&other: LiveNodeKind) -> bool { !self.eq(other) }
}
fn check_crate(tcx: ty::ctxt,

View File

@ -115,6 +115,7 @@ impl categorization : cmp::Eq {
}
}
}
pure fn ne(&&other: categorization) -> bool { !self.eq(other) }
}
// different kinds of pointers:
@ -154,6 +155,7 @@ impl ptr_kind : cmp::Eq {
}
}
}
pure fn ne(&&other: ptr_kind) -> bool { !self.eq(other) }
}
// I am coining the term "components" to mean "pieces of a data
@ -196,6 +198,7 @@ impl comp_kind : cmp::Eq {
}
}
}
pure fn ne(&&other: comp_kind) -> bool { !self.eq(other) }
}
// different kinds of expressions we might evaluate
@ -210,6 +213,7 @@ impl special_kind : cmp::Eq {
pure fn eq(&&other: special_kind) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: special_kind) -> bool { !self.eq(other) }
}
// a complete categorization of a value indicating where it originated
@ -233,6 +237,7 @@ impl cmt_ : cmp::Eq {
self.mutbl == other.mutbl &&
self.ty == other.ty
}
pure fn ne(&&other: cmt_) -> bool { !self.eq(other) }
}
// a loan path is like a category, but it exists only when the data is
@ -274,6 +279,7 @@ impl loan_path : cmp::Eq {
}
}
}
pure fn ne(&&other: loan_path) -> bool { !self.eq(other) }
}
// We pun on *T to mean both actual deref of a ptr as well

View File

@ -378,6 +378,7 @@ impl region_dep: cmp::Eq {
pure fn eq(&&other: region_dep) -> bool {
self.ambient_variance == other.ambient_variance && self.id == other.id
}
pure fn ne(&&other: region_dep) -> bool { !self.eq(other) }
}
type determine_rp_ctxt_ = {

View File

@ -114,6 +114,7 @@ impl PatternBindingMode : cmp::Eq {
pure fn eq(&&other: PatternBindingMode) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: PatternBindingMode) -> bool { !self.eq(other) }
}
@ -154,6 +155,7 @@ impl Mutability : cmp::Eq {
pure fn eq(&&other: Mutability) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: Mutability) -> bool { !self.eq(other) }
}
enum SelfBinding {
@ -188,6 +190,7 @@ impl ImportDirectiveNS : cmp::Eq {
pure fn eq(&&other: ImportDirectiveNS) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: ImportDirectiveNS) -> bool { !self.eq(other) }
}
/// Contains data for specific types of import directives.
@ -274,6 +277,7 @@ impl XrayFlag : cmp::Eq {
pure fn eq(&&other: XrayFlag) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: XrayFlag) -> bool { !self.eq(other) }
}
enum AllowCapturingSelfFlag {
@ -285,6 +289,7 @@ impl AllowCapturingSelfFlag : cmp::Eq {
pure fn eq(&&other: AllowCapturingSelfFlag) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: AllowCapturingSelfFlag) -> bool { !self.eq(other) }
}
enum EnumVariantOrConstResolution {
@ -483,6 +488,7 @@ impl Privacy : cmp::Eq {
pure fn eq(&&other: Privacy) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: Privacy) -> bool { !self.eq(other) }
}
// Records a possibly-private definition.

View File

@ -424,6 +424,7 @@ impl branch_kind : cmp::Eq {
pure fn eq(&&other: branch_kind) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: branch_kind) -> bool { !self.eq(other) }
}
fn compile_submatch(bcx: block, m: match_, vals: ~[ValueRef],

View File

@ -288,6 +288,7 @@ impl cleantype : cmp::Eq {
}
}
}
pure fn ne(&&other: cleantype) -> bool { !self.eq(other) }
}
// Used to remember and reuse existing cleanup paths
@ -1114,12 +1115,14 @@ impl mono_param_id: cmp::Eq {
(mono_repr(*), _) => false
}
}
pure fn ne(&&other: mono_param_id) -> bool { !self.eq(other) }
}
impl mono_id_: cmp::Eq {
pure fn eq(&&other: mono_id_) -> bool {
return self.def == other.def && self.params == other.params;
}
pure fn ne(&&other: mono_id_) -> bool { !self.eq(other) }
}
pure fn hash_mono_id(mi: &mono_id) -> uint {

View File

@ -748,4 +748,5 @@ impl CopyAction : cmp::Eq {
(DROP_EXISTING, _) => false,
}
}
pure fn ne(&&other: CopyAction) -> bool { !self.eq(other) }
}

View File

@ -157,6 +157,7 @@ impl Dest : cmp::Eq {
(Ignore, _) => false,
}
}
pure fn ne(&&other: Dest) -> bool { !self.eq(other) }
}
fn trans_to_appropriate_llval(bcx: block,
@ -1265,6 +1266,7 @@ impl cast_kind : cmp::Eq {
(cast_other, _) => false,
}
}
pure fn ne(&&other: cast_kind) -> bool { !self.eq(other) }
}
fn cast_type_kind(t: ty::t) -> cast_kind {
@ -1381,4 +1383,4 @@ fn trans_assign_op(bcx: block,
fn shorten(+x: ~str) -> ~str {
if x.len() > 60 { x.substr(0, 60) } else { x }
}
}

View File

@ -44,6 +44,7 @@ impl x86_64_reg_class: cmp::Eq {
pure fn eq(&&other: x86_64_reg_class) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: x86_64_reg_class) -> bool { !self.eq(other) }
}
fn is_sse(++c: x86_64_reg_class) -> bool {

View File

@ -234,6 +234,7 @@ impl intern_key: cmp::Eq {
pure fn eq(&&other: intern_key) -> bool {
self.struct == other.struct && self.o_def_id == other.o_def_id
}
pure fn ne(&&other: intern_key) -> bool { !self.eq(other) }
}
enum ast_ty_to_ty_cache_entry {
@ -258,6 +259,7 @@ impl region_variance: cmp::Eq {
(rv_contravariant, _) => false
}
}
pure fn ne(&&other: region_variance) -> bool { !self.eq(other) }
}
// N.B.: Borrows from inlined content are not accurately deserialized. This
@ -272,6 +274,7 @@ impl borrow : cmp::Eq {
pure fn eq(&&other: borrow) -> bool {
self.region == other.region && self.mutbl == other.mutbl
}
pure fn ne(&&other: borrow) -> bool { !self.eq(other) }
}
type ctxt =
@ -367,6 +370,7 @@ impl closure_kind : cmp::Eq {
pure fn eq(&&other: closure_kind) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: closure_kind) -> bool { !self.eq(other) }
}
enum fn_proto {
@ -391,6 +395,7 @@ impl fn_proto : cmp::Eq {
}
}
}
pure fn ne(&&other: fn_proto) -> bool { !self.eq(other) }
}
/**
@ -436,6 +441,7 @@ impl param_ty: cmp::Eq {
pure fn eq(&&other: param_ty) -> bool {
self.idx == other.idx && self.def_id == other.def_id
}
pure fn ne(&&other: param_ty) -> bool { !self.eq(other) }
}
/// Representation of regions:
@ -3709,18 +3715,21 @@ impl mt : cmp::Eq {
pure fn eq(&&other: mt) -> bool {
self.ty == other.ty && self.mutbl == other.mutbl
}
pure fn ne(&&other: mt) -> bool { !self.eq(other) }
}
impl arg : cmp::Eq {
pure fn eq(&&other: arg) -> bool {
self.mode == other.mode && self.ty == other.ty
}
pure fn ne(&&other: arg) -> bool { !self.eq(other) }
}
impl field : cmp::Eq {
pure fn eq(&&other: field) -> bool {
self.ident == other.ident && self.mt == other.mt
}
pure fn ne(&&other: field) -> bool { !self.eq(other) }
}
impl vstore : cmp::Eq {
@ -3752,6 +3761,7 @@ impl vstore : cmp::Eq {
}
}
}
pure fn ne(&&other: vstore) -> bool { !self.eq(other) }
}
impl FnMeta : cmp::Eq {
@ -3761,6 +3771,7 @@ impl FnMeta : cmp::Eq {
self.bounds == other.bounds &&
self.ret_style == other.ret_style
}
pure fn ne(&&other: FnMeta) -> bool { !self.eq(other) }
}
impl FnSig : cmp::Eq {
@ -3768,36 +3779,35 @@ impl FnSig : cmp::Eq {
self.inputs == other.inputs &&
self.output == other.output
}
pure fn ne(&&other: FnSig) -> bool { !self.eq(other) }
}
impl<M: cmp::Eq> FnTyBase<M> : cmp::Eq {
pure fn eq(&&other: FnTyBase<M>) -> bool {
self.meta == other.meta && self.sig == other.sig
}
pure fn ne(&&other: FnTyBase<M>) -> bool { !self.eq(other) }
}
impl TyVid: cmp::Eq {
pure fn eq(&&other: TyVid) -> bool {
*self == *other
}
pure fn eq(&&other: TyVid) -> bool { *self == *other }
pure fn ne(&&other: TyVid) -> bool { *self != *other }
}
impl IntVid: cmp::Eq {
pure fn eq(&&other: IntVid) -> bool {
*self == *other
}
pure fn eq(&&other: IntVid) -> bool { *self == *other }
pure fn ne(&&other: IntVid) -> bool { *self != *other }
}
impl FnVid: cmp::Eq {
pure fn eq(&&other: FnVid) -> bool {
*self == *other
}
pure fn eq(&&other: FnVid) -> bool { *self == *other }
pure fn ne(&&other: FnVid) -> bool { *self != *other }
}
impl RegionVid: cmp::Eq {
pure fn eq(&&other: RegionVid) -> bool {
*self == *other
}
pure fn eq(&&other: RegionVid) -> bool { *self == *other }
pure fn ne(&&other: RegionVid) -> bool { *self != *other }
}
impl region : cmp::Eq {
@ -3835,6 +3845,7 @@ impl region : cmp::Eq {
}
}
}
pure fn ne(&&other: region) -> bool { !self.eq(other) }
}
impl bound_region : cmp::Eq {
@ -3866,6 +3877,7 @@ impl bound_region : cmp::Eq {
}
}
}
pure fn ne(&&other: bound_region) -> bool { !self.eq(other) }
}
impl substs : cmp::Eq {
@ -3874,12 +3886,14 @@ impl substs : cmp::Eq {
self.self_ty == other.self_ty &&
self.tps == other.tps
}
pure fn ne(&&other: substs) -> bool { !self.eq(other) }
}
impl InferTy : cmp::Eq {
pure fn eq(&&other: InferTy) -> bool {
self.to_hash() == other.to_hash()
}
pure fn ne(&&other: InferTy) -> bool { !self.eq(other) }
}
impl sty : cmp::Eq {
@ -4038,6 +4052,7 @@ impl sty : cmp::Eq {
}
}
}
pure fn ne(&&other: sty) -> bool { !self.eq(other) }
}
impl param_bound : cmp::Eq {
@ -4075,12 +4090,12 @@ impl param_bound : cmp::Eq {
}
}
}
pure fn ne(&&other: param_bound) -> bool { !self.eq(other) }
}
impl kind : cmp::Eq {
pure fn eq(&&other: kind) -> bool {
*self == *other
}
pure fn eq(&&other: kind) -> bool { *self == *other }
pure fn ne(&&other: kind) -> bool { *self != *other }
}

View File

@ -346,6 +346,7 @@ impl Constraint: cmp::Eq {
(ConstrainVarSubReg(*), _) => false
}
}
pure fn ne(&&other: Constraint) -> bool { !self.eq(other) }
}
struct TwoRegions {
@ -357,6 +358,7 @@ impl TwoRegions: cmp::Eq {
pure fn eq(&&other: TwoRegions) -> bool {
self.a == other.a && self.b == other.b
}
pure fn ne(&&other: TwoRegions) -> bool { !self.eq(other) }
}
enum UndoLogEntry {
@ -753,6 +755,7 @@ impl Direction : cmp::Eq {
pure fn eq(&&other: Direction) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: Direction) -> bool { !self.eq(other) }
}
enum Classification { Expanding, Contracting }
@ -761,6 +764,7 @@ impl Classification : cmp::Eq {
pure fn eq(&&other: Classification) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: Classification) -> bool { !self.eq(other) }
}
enum GraphNodeValue { NoValue, Value(region), ErrorValue }

View File

@ -22,6 +22,7 @@ impl output_format : cmp::Eq {
pure fn eq(&&other: output_format) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: output_format) -> bool { !self.eq(other) }
}
/// How to organize the output
@ -36,6 +37,7 @@ impl output_style : cmp::Eq {
pure fn eq(&&other: output_style) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: output_style) -> bool { !self.eq(other) }
}
/// The configuration for a rustdoc session

View File

@ -10,6 +10,7 @@ impl doc_ : cmp::Eq {
pure fn eq(&&other: doc_) -> bool {
self.pages == other.pages
}
pure fn ne(&&other: doc_) -> bool { !self.eq(other) }
}
enum doc {
@ -17,9 +18,8 @@ enum doc {
}
impl doc : cmp::Eq {
pure fn eq(&&other: doc) -> bool {
*self == *other
}
pure fn eq(&&other: doc) -> bool { *self == *other }
pure fn ne(&&other: doc) -> bool { *self != *other }
}
enum page {
@ -44,6 +44,7 @@ impl page : cmp::Eq {
}
}
}
pure fn ne(&&other: page) -> bool { !self.eq(other) }
}
enum implementation {
@ -55,6 +56,7 @@ impl implementation : cmp::Eq {
pure fn eq(&&other: implementation) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: implementation) -> bool { !self.eq(other) }
}
@ -71,6 +73,7 @@ impl section : cmp::Eq {
pure fn eq(&&other: section) -> bool {
self.header == other.header && self.body == other.body
}
pure fn ne(&&other: section) -> bool { !self.eq(other) }
}
// FIXME (#2596): We currently give topmod the name of the crate. There
@ -84,6 +87,7 @@ impl cratedoc : cmp::Eq {
pure fn eq(&&other: cratedoc) -> bool {
self.topmod == other.topmod
}
pure fn ne(&&other: cratedoc) -> bool { !self.eq(other) }
}
enum itemtag {
@ -150,6 +154,7 @@ impl itemtag : cmp::Eq {
}
}
}
pure fn ne(&&other: itemtag) -> bool { !self.eq(other) }
}
type itemdoc = {
@ -173,6 +178,7 @@ impl itemdoc : cmp::Eq {
self.sections == other.sections &&
self.reexport == other.reexport
}
pure fn ne(&&other: itemdoc) -> bool { !self.eq(other) }
}
type simpleitemdoc = {
@ -184,6 +190,7 @@ impl simpleitemdoc : cmp::Eq {
pure fn eq(&&other: simpleitemdoc) -> bool {
self.item == other.item && self.sig == other.sig
}
pure fn ne(&&other: simpleitemdoc) -> bool { !self.eq(other) }
}
type moddoc_ = {
@ -198,6 +205,7 @@ impl moddoc_ : cmp::Eq {
self.items == other.items &&
self.index == other.index
}
pure fn ne(&&other: moddoc_) -> bool { !self.eq(other) }
}
enum moddoc {
@ -205,9 +213,8 @@ enum moddoc {
}
impl moddoc : cmp::Eq {
pure fn eq(&&other: moddoc) -> bool {
*self == *other
}
pure fn eq(&&other: moddoc) -> bool { *self == *other }
pure fn ne(&&other: moddoc) -> bool { *self != *other }
}
type nmoddoc = {
@ -222,6 +229,7 @@ impl nmoddoc : cmp::Eq {
self.fns == other.fns &&
self.index == other.index
}
pure fn ne(&&other: nmoddoc) -> bool { !self.eq(other) }
}
type constdoc = simpleitemdoc;
@ -237,6 +245,7 @@ impl enumdoc : cmp::Eq {
pure fn eq(&&other: enumdoc) -> bool {
self.item == other.item && self.variants == other.variants
}
pure fn ne(&&other: enumdoc) -> bool { !self.eq(other) }
}
type variantdoc = {
@ -251,6 +260,7 @@ impl variantdoc : cmp::Eq {
self.desc == other.desc &&
self.sig == other.sig
}
pure fn ne(&&other: variantdoc) -> bool { !self.eq(other) }
}
type traitdoc = {
@ -262,6 +272,7 @@ impl traitdoc : cmp::Eq {
pure fn eq(&&other: traitdoc) -> bool {
self.item == other.item && self.methods == other.methods
}
pure fn ne(&&other: traitdoc) -> bool { !self.eq(other) }
}
type methoddoc = {
@ -282,6 +293,7 @@ impl methoddoc : cmp::Eq {
self.sig == other.sig &&
self.implementation == other.implementation
}
pure fn ne(&&other: methoddoc) -> bool { !self.eq(other) }
}
type impldoc = {
@ -298,6 +310,7 @@ impl impldoc : cmp::Eq {
self.self_ty == other.self_ty &&
self.methods == other.methods
}
pure fn ne(&&other: impldoc) -> bool { !self.eq(other) }
}
type tydoc = simpleitemdoc;
@ -310,6 +323,7 @@ impl index : cmp::Eq {
pure fn eq(&&other: index) -> bool {
self.entries == other.entries
}
pure fn ne(&&other: index) -> bool { !self.eq(other) }
}
/**
@ -336,6 +350,7 @@ impl index_entry : cmp::Eq {
self.brief == other.brief &&
self.link == other.link
}
pure fn ne(&&other: index_entry) -> bool { !self.eq(other) }
}
impl doc {

View File

@ -46,13 +46,14 @@ impl an_enum : cmp::Eq {
pure fn eq(&&other: an_enum) -> bool {
self.v == other.v
}
pure fn ne(&&other: an_enum) -> bool { !self.eq(other) }
}
impl point : cmp::Eq {
pure fn eq(&&other: point) -> bool {
self.x == other.x &&
self.y == other.y
self.x == other.x && self.y == other.y
}
pure fn ne(&&other: point) -> bool { !self.eq(other) }
}
impl<T:cmp::Eq> quark<T> : cmp::Eq {
@ -68,6 +69,7 @@ impl<T:cmp::Eq> quark<T> : cmp::Eq {
}
}
}
pure fn ne(&&other: quark<T>) -> bool { !self.eq(other) }
}
@ -75,6 +77,7 @@ impl c_like : cmp::Eq {
pure fn eq(&&other: c_like) -> bool {
self as int == other as int
}
pure fn ne(&&other: c_like) -> bool { !self.eq(other) }
}
impl expr : cmp::Eq {
@ -100,6 +103,7 @@ impl expr : cmp::Eq {
}
}
}
pure fn ne(&&other: expr) -> bool { !self.eq(other) }
}
#[auto_serialize]
@ -109,6 +113,7 @@ impl<T:cmp::Eq> spanned<T> : cmp::Eq {
pure fn eq(&&other: spanned<T>) -> bool {
self.lo == other.lo && self.hi == other.hi && self.node.eq(other.node)
}
pure fn ne(&&other: spanned<T>) -> bool { !self.eq(other) }
}
#[auto_serialize]

View File

@ -93,6 +93,7 @@ impl p : cmp::Eq {
pure fn eq(&&other: p) -> bool {
self.x == other.x && self.y == other.y
}
pure fn ne(&&other: p) -> bool { !self.eq(other) }
}
fn test_class() {

View File

@ -7,6 +7,7 @@ impl cat_type : cmp::Eq {
pure fn eq(&&other: cat_type) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: cat_type) -> bool { !self.eq(other) }
}
// Very silly -- this just returns the value of the name field

View File

@ -2,5 +2,6 @@ fn main() {
enum x { foo }
impl x : core::cmp::Eq {
pure fn eq(&&other: x) -> bool { self as int == other as int }
pure fn ne(&&other: x) -> bool { !self.eq(other) }
}
}

View File

@ -5,6 +5,7 @@ impl foo : cmp::Eq {
pure fn eq(&&other: foo) -> bool {
self.a == other.a && self.b == other.b && self.c == other.c
}
pure fn ne(&&other: foo) -> bool { !self.eq(other) }
}
const x : foo = foo { a:1, b:2, c: 3 };

View File

@ -4,6 +4,7 @@ impl chan : cmp::Eq {
pure fn eq(&&other: chan) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: chan) -> bool { !self.eq(other) }
}
fn wrapper3(i: chan) {

View File

@ -12,6 +12,7 @@ mod foo {
pure fn eq(&&other: t) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: t) -> bool { !self.eq(other) }
}
fn f() -> t { return t1; }

View File

@ -14,6 +14,7 @@ impl mood : cmp::Eq {
pure fn eq(&&other: mood) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: mood) -> bool { !self.eq(other) }
}
fn test_tag() {

View File

@ -14,6 +14,7 @@ impl mood : cmp::Eq {
pure fn eq(&&other: mood) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: mood) -> bool { !self.eq(other) }
}
fn test_tag() {

View File

@ -12,6 +12,7 @@ mod pipes {
pure fn eq(&&other: state) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: state) -> bool { !self.eq(other) }
}
type packet<T: send> = {

View File

@ -31,6 +31,7 @@ impl Point : cmp::Eq {
pure fn eq(&&other: Point) -> bool {
self.x == other.x && self.y == other.y
}
pure fn ne(&&other: Point) -> bool { !self.eq(other) }
}
fn main() {

View File

@ -6,6 +6,7 @@ impl foo : cmp::Eq {
pure fn eq(&&other: foo) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: foo) -> bool { !self.eq(other) }
}
fn main() {

View File

@ -13,6 +13,7 @@ impl color : cmp::Eq {
pure fn eq(&&other: color) -> bool {
(self as uint) == (other as uint)
}
pure fn ne(&&other: color) -> bool { !self.eq(other) }
}
fn main() {

View File

@ -71,6 +71,7 @@ impl t : cmp::Eq {
}
}
}
pure fn ne(&&other: t) -> bool { !self.eq(other) }
}
fn test_tag() {