use middle::moves;
use util::ppaux::ty_to_str;
-use core::cmp;
use core::hashmap::linear::LinearMap;
use core::io::WriterUtil;
use core::io;
// if it detects an outstanding loan (that is, the addr is taken).
pub type last_use_map = @mut LinearMap<node_id, @mut ~[node_id]>;
+#[deriving(Eq)]
struct Variable(uint);
+#[deriving(Eq)]
struct LiveNode(uint);
-impl cmp::Eq for Variable {
- fn eq(&self, other: &Variable) -> bool { *(*self) == *(*other) }
- fn ne(&self, other: &Variable) -> bool { *(*self) != *(*other) }
-}
-
-impl cmp::Eq for LiveNode {
- fn eq(&self, other: &LiveNode) -> bool { *(*self) == *(*other) }
- fn ne(&self, other: &LiveNode) -> bool { *(*self) != *(*other) }
-}
-
+#[deriving(Eq)]
enum LiveNodeKind {
FreeVarNode(span),
ExprNode(span),
ExitNode
}
-impl cmp::Eq for LiveNodeKind {
- fn eq(&self, 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
- }
- }
- }
- }
- fn ne(&self, other: &LiveNodeKind) -> bool { !(*self).eq(other) }
-}
-
fn live_node_kind_to_str(lnk: LiveNodeKind, cx: ty::ctxt) -> ~str {
let cm = cx.sess.codemap;
match lnk {
use middle::trans::common::*;
use middle::trans::cabi::*;
-use core::cmp;
use core::libc::c_uint;
use core::option;
use core::option::Option;
use core::uint;
use core::vec;
+#[deriving(Eq)]
enum x86_64_reg_class {
no_class,
integer_class,
memory_class
}
-impl cmp::Eq for x86_64_reg_class {
- fn eq(&self, other: &x86_64_reg_class) -> bool {
- ((*self) as uint) == ((*other) as uint)
- }
- fn ne(&self, other: &x86_64_reg_class) -> bool { !(*self).eq(other) }
-}
-
fn is_sse(++c: x86_64_reg_class) -> bool {
return match c {
sse_fs_class | sse_fv_class |
use util::common::indenter;
use util::ppaux::ty_to_str;
-use core::cmp;
use core::container::Set; // XXX: this should not be necessary
use core::to_bytes;
use core::uint;
datum: Datum,
}
+#[deriving(Eq)]
pub enum DatumMode {
/// `val` is a pointer to the actual value (and thus has type *T)
ByRef,
}
}
-impl cmp::Eq for DatumMode {
- fn eq(&self, other: &DatumMode) -> bool {
- (*self) as uint == (*other as uint)
- }
- fn ne(&self, other: &DatumMode) -> bool { !(*self).eq(other) }
-}
-
impl to_bytes::IterBytes for DatumMode {
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
(*self as uint).iter_bytes(lsb0, f)
// These are passed around by the code generating functions to track the
// destination of a computation's value.
+#[deriving(Eq)]
pub enum Dest {
SaveIn(ValueRef),
Ignore,
}
}
-impl cmp::Eq for Dest {
- fn eq(&self, other: &Dest) -> bool {
- match ((*self), (*other)) {
- (SaveIn(e0a), SaveIn(e0b)) => e0a == e0b,
- (Ignore, Ignore) => true,
- (SaveIn(*), _) => false,
- (Ignore, _) => false,
- }
- }
- fn ne(&self, other: &Dest) -> bool { !(*self).eq(other) }
-}
-
fn drop_and_cancel_clean(bcx: block, dat: Datum) -> block {
let bcx = dat.drop_val(bcx);
dat.cancel_clean(bcx);
} else { llsrc };
}
+#[deriving(Eq)]
pub enum cast_kind {
cast_pointer,
cast_integral,
cast_other,
}
-impl cmp::Eq for cast_kind {
- fn eq(&self, 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,
- }
- }
- fn ne(&self, other: &cast_kind) -> bool { !(*self).eq(other) }
-}
-
pub fn cast_type_kind(t: ty::t) -> cast_kind {
match ty::get(t).sty {
ty::ty_float(*) => cast_float,
def_id: ast::def_id
}
+#[deriving(Eq)]
pub struct mt {
ty: t,
mutbl: ast::mutability,
#[auto_encode]
#[auto_decode]
+#[deriving(Eq)]
pub enum region_variance { rv_covariant, rv_invariant, rv_contravariant }
-impl cmp::Eq for region_variance {
- fn eq(&self, other: ®ion_variance) -> bool {
- match ((*self), (*other)) {
- (rv_covariant, rv_covariant) => true,
- (rv_invariant, rv_invariant) => true,
- (rv_contravariant, rv_contravariant) => true,
- (rv_covariant, _) => false,
- (rv_invariant, _) => false,
- (rv_contravariant, _) => false
- }
- }
- fn ne(&self, other: ®ion_variance) -> bool { !(*self).eq(other) }
-}
-
#[auto_encode]
#[auto_decode]
pub enum AutoAdjustment {
/// Representation of regions:
#[auto_encode]
#[auto_decode]
+#[deriving(Eq)]
pub enum Region {
/// Bound regions are found (primarily) in function types. They indicate
/// region parameters that have yet to be replaced with actual regions
#[auto_encode]
#[auto_decode]
+#[deriving(Eq)]
pub enum bound_region {
/// The self region for structs, impls (&T in a type defn or &'self T)
br_self,
terr_float_mismatch(expected_found<ast::float_ty>)
}
+#[deriving(Eq)]
pub enum param_bound {
bound_copy,
bound_durable,
}
}
-impl cmp::Eq for mt {
- fn eq(&self, other: &mt) -> bool {
- (*self).ty == (*other).ty && (*self).mutbl == (*other).mutbl
- }
- fn ne(&self, other: &mt) -> bool { !(*self).eq(other) }
-}
-
-impl cmp::Eq for Region {
- fn eq(&self, 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
- }
- }
- }
- }
- fn ne(&self, other: &Region) -> bool { !(*self).eq(other) }
-}
-
-impl cmp::Eq for bound_region {
- fn eq(&self, 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
- }
- }
- br_fresh(e0a) => {
- match (*other) {
- br_fresh(e0b) => e0a == e0b,
- _ => false
- }
- }
- }
- }
- fn ne(&self, other: &bound_region) -> bool { !(*self).eq(other) }
-}
-
-impl cmp::Eq for param_bound {
- fn eq(&self, other: ¶m_bound) -> bool {
- match (*self) {
- bound_copy => {
- match (*other) {
- bound_copy => true,
- _ => false
- }
- }
- bound_durable => {
- match (*other) {
- bound_durable => true,
- _ => false
- }
- }
- bound_owned => {
- match (*other) {
- bound_owned => true,
- _ => false
- }
- }
- bound_const => {
- match (*other) {
- bound_const => true,
- _ => false
- }
- }
- bound_trait(e0a) => {
- match (*other) {
- bound_trait(e0b) => e0a == e0b,
- _ => false
- }
- }
- }
- }
- fn ne(&self, other: ¶m_bound) -> bool { !self.eq(other) }
-}
-
// Local Variables:
// mode: rust
// fill-column: 78;
use util::ppaux::note_and_explain_region;
use core::cell::{Cell, empty_cell};
-use core::cmp;
use core::hashmap::linear::{LinearMap, LinearSet};
use core::result::{Err, Ok, Result};
use core::to_bytes;
use core::vec;
use syntax::codemap::span;
+#[deriving(Eq)]
enum Constraint {
ConstrainVarSubVar(RegionVid, RegionVid),
ConstrainRegSubVar(Region, RegionVid),
ConstrainVarSubReg(RegionVid, Region)
}
-impl cmp::Eq for Constraint {
- fn eq(&self, 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
- }
- }
- fn ne(&self, other: &Constraint) -> bool { !(*self).eq(other) }
-}
-
impl to_bytes::IterBytes for Constraint {
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
match *self {
}
}
+#[deriving(Eq)]
struct TwoRegions {
a: Region,
b: Region,
}
-impl cmp::Eq for TwoRegions {
- fn eq(&self, other: &TwoRegions) -> bool {
- (*self).a == (*other).a && (*self).b == (*other).b
- }
- fn ne(&self, other: &TwoRegions) -> bool { !(*self).eq(other) }
-}
-
impl to_bytes::IterBytes for TwoRegions {
fn iter_bytes(&self, +lsb0: bool, f: to_bytes::Cb) {
to_bytes::iter_bytes_2(&self.a, &self.b, lsb0, f)
Exit
}
+#[deriving(Clone)]
pub struct Srv {
ch: SharedChan<Msg>
}
-impl Clone for Srv {
- fn clone(&self) -> Srv {
- Srv {
- ch: self.ch.clone()
- }
- }
-}
-
pub fn from_str<T>(source: ~str, owner: SrvOwner<T>) -> T {
run(owner, copy source, parse::from_str_sess)
}
use core::prelude::*;
use core::cell::Cell;
-use core::cmp;
use core::os;
use core::result;
use core::run;
use std::getopts;
/// The type of document to output
+#[deriving(Eq)]
pub enum OutputFormat {
/// Markdown
pub Markdown,
pub PandocHtml
}
-impl cmp::Eq for OutputFormat {
- fn eq(&self, other: &OutputFormat) -> bool {
- ((*self) as uint) == ((*other) as uint)
- }
- fn ne(&self, other: &OutputFormat) -> bool { !(*self).eq(other) }
-}
-
/// How to organize the output
+#[deriving(Eq)]
pub enum OutputStyle {
/// All in a single document
pub DocPerCrate,
pub DocPerMod
}
-impl cmp::Eq for OutputStyle {
- fn eq(&self, other: &OutputStyle) -> bool {
- ((*self) as uint) == ((*other) as uint)
- }
- fn ne(&self, other: &OutputStyle) -> bool { !(*self).eq(other) }
-}
-
/// The configuration for a rustdoc session
pub struct Config {
input_crate: Path,
use diagnostic::span_handler;
use parse::comments::{doc_comment_style, strip_doc_comment_decoration};
-use core::cmp;
use core::either::Either;
use core::vec;
use core::hashmap::linear::LinearSet;
};
}
+#[deriving(Eq)]
pub enum inline_attr {
ia_none,
ia_hint,
ia_never,
}
-impl cmp::Eq for inline_attr {
- fn eq(&self, other: &inline_attr) -> bool {
- ((*self) as uint) == ((*other) as uint)
- }
- fn ne(&self, other: &inline_attr) -> bool { !(*self).eq(other) }
-}
-
/// True if something like #[inline] is found in the list of attrs.
pub fn find_inline_attr(attrs: &[ast::attribute]) -> inline_attr {
// FIXME (#2809)---validate the usage of #[inline] and #[inline(always)]
}
/// A byte offset
+#[deriving(Eq)]
pub struct BytePos(uint);
/// A character offset. Because of multibyte utf8 characters, a byte offset
/// is not equivalent to a character offset. The CodeMap will convert BytePos
/// values to CharPos values as necessary.
+#[deriving(Eq)]
pub struct CharPos(uint);
// XXX: Lots of boilerplate in these impls, but so far my attempts to fix
fn to_uint(&self) -> uint { **self }
}
-impl cmp::Eq for BytePos {
- fn eq(&self, other: &BytePos) -> bool { **self == **other }
- fn ne(&self, other: &BytePos) -> bool { !(*self).eq(other) }
-}
-
impl cmp::Ord for BytePos {
fn lt(&self, other: &BytePos) -> bool { **self < **other }
fn le(&self, other: &BytePos) -> bool { **self <= **other }
fn to_uint(&self) -> uint { **self }
}
-impl cmp::Eq for CharPos {
- fn eq(&self, other: &CharPos) -> bool { **self == **other }
- fn ne(&self, other: &CharPos) -> bool { !(*self).eq(other) }
-}
-
impl cmp::Ord for CharPos {
fn lt(&self, other: &CharPos) -> bool { **self < **other }
fn le(&self, other: &CharPos) -> bool { **self <= **other }
use parse::token;
use parse;
-use core::cmp;
use core::io::ReaderUtil;
use core::io;
use core::str;
use core::uint;
use core::vec;
+#[deriving(Eq)]
pub enum cmnt_style {
isolated, // No code on either side of each line of the comment
trailing, // Code exists to the left of the comment
blank_line, // Just a manual blank line "\n\n", for layout
}
-impl cmp::Eq for cmnt_style {
- fn eq(&self, other: &cmnt_style) -> bool {
- ((*self) as uint) == ((*other) as uint)
- }
- fn ne(&self, other: &cmnt_style) -> bool {
- ((*self) as uint) != ((*other) as uint)
- }
-}
-
pub struct cmnt {
style: cmnt_style,
lines: ~[~str],