diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-05-29 17:45:07 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-05-30 15:52:24 -0700 |
| commit | 748bc3ca49de8ab0b890726120c40567094e43fc (patch) | |
| tree | a205dcd5582cbecbb1a02fa3ed1ebfdcc85ff881 /src/libsyntax | |
| parent | f4fa7c8a07a96cc9d0aae0bfc6515fb747f25341 (diff) | |
| download | rust-748bc3ca49de8ab0b890726120c40567094e43fc.tar.gz rust-748bc3ca49de8ab0b890726120c40567094e43fc.zip | |
std: Rename {Eq,Ord} to Partial{Eq,Ord}
This is part of the ongoing renaming of the equality traits. See #12517 for more
details. All code using Eq/Ord will temporarily need to move to Partial{Eq,Ord}
or the Total{Eq,Ord} traits. The Total traits will soon be renamed to {Eq,Ord}.
cc #12517
[breaking-change]
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/abi.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/ast.rs | 170 | ||||
| -rw-r--r-- | src/libsyntax/ast_map.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/attr.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/codemap.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/crateid.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/diagnostic.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving/generic/mod.rs | 20 | ||||
| -rw-r--r-- | src/libsyntax/ext/deriving/mod.rs | 5 | ||||
| -rw-r--r-- | src/libsyntax/ext/format.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/mtwt.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/owned_slice.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/comments.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/lexer.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/obsolete.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/parse/token.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/print/pp.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/util/interner.rs | 2 |
19 files changed, 126 insertions, 127 deletions
diff --git a/src/libsyntax/abi.rs b/src/libsyntax/abi.rs index 089cd772bb4..e61c1c24c2f 100644 --- a/src/libsyntax/abi.rs +++ b/src/libsyntax/abi.rs @@ -10,10 +10,10 @@ use std::fmt; -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum Os { OsWin32, OsMacos, OsLinux, OsAndroid, OsFreebsd, } -#[deriving(Eq, TotalEq, Hash, Encodable, Decodable, Clone)] +#[deriving(PartialEq, TotalEq, Hash, Encodable, Decodable, Clone)] pub enum Abi { // NB: This ordering MUST match the AbiDatas array below. // (This is ensured by the test indices_are_correct().) @@ -33,7 +33,7 @@ pub enum Abi { } #[allow(non_camel_case_types)] -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum Architecture { // NB. You cannot change the ordering of these // constants without adjusting IntelBits below. diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 656ae80e12d..5eb9308e443 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -39,7 +39,7 @@ pub fn P<T: 'static>(value: T) -> P<T> { // table) and a SyntaxContext to track renaming and // macro expansion per Flatt et al., "Macros // That Work Together" -#[deriving(Clone, Hash, Ord, TotalEq, TotalOrd, Show)] +#[deriving(Clone, Hash, PartialOrd, TotalEq, TotalOrd, Show)] pub struct Ident { pub name: Name, pub ctxt: SyntaxContext @@ -50,7 +50,7 @@ impl Ident { pub fn new(name: Name) -> Ident { Ident {name: name, ctxt: EMPTY_CTXT}} } -impl Eq for Ident { +impl PartialEq for Ident { fn eq(&self, other: &Ident) -> bool { if self.ctxt == other.ctxt { self.name == other.name @@ -114,7 +114,7 @@ impl<D:Decoder<E>, E> Decodable<D, E> for Ident { /// Function name (not all functions have names) pub type FnIdent = Option<Ident>; -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct Lifetime { pub id: NodeId, pub span: Span, @@ -122,10 +122,10 @@ pub struct Lifetime { } // a "Path" is essentially Rust's notion of a name; -// for instance: std::cmp::Eq . It's represented +// for instance: std::cmp::PartialEq . It's represented // as a sequence of identifiers, along with a bunch // of supporting information. -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct Path { pub span: Span, /// A `::foo` path, is relative to the crate root rather than current @@ -137,7 +137,7 @@ pub struct Path { /// A segment of a path: an identifier, an optional lifetime, and a set of /// types. -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct PathSegment { /// The identifier portion of this path segment. pub identifier: Ident, @@ -151,7 +151,7 @@ pub type CrateNum = u32; pub type NodeId = u32; -#[deriving(Clone, TotalEq, TotalOrd, Ord, Eq, Encodable, Decodable, Hash, Show)] +#[deriving(Clone, TotalEq, TotalOrd, PartialOrd, PartialEq, Encodable, Decodable, Hash, Show)] pub struct DefId { pub krate: CrateNum, pub node: NodeId, @@ -171,14 +171,14 @@ pub static DUMMY_NODE_ID: NodeId = -1; // typeck::collect::compute_bounds matches these against // the "special" built-in traits (see middle::lang_items) and // detects Copy, Send and Share. -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum TyParamBound { TraitTyParamBound(TraitRef), StaticRegionTyParamBound, OtherRegionTyParamBound(Span) // FIXME -- just here until work for #5723 lands } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct TyParam { pub ident: Ident, pub id: NodeId, @@ -188,7 +188,7 @@ pub struct TyParam { pub span: Span } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct Generics { pub lifetimes: Vec<Lifetime>, pub ty_params: OwnedSlice<TyParam>, @@ -206,13 +206,13 @@ impl Generics { } } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum MethodProvenance { FromTrait(DefId), FromImpl(DefId), } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum Def { DefFn(DefId, FnStyle), DefStaticMethod(/* method */ DefId, MethodProvenance, FnStyle), @@ -249,7 +249,7 @@ pub enum Def { DefMethod(DefId /* method */, Option<DefId> /* trait */), } -#[deriving(Clone, Eq, TotalEq, Hash, Encodable, Decodable, Show)] +#[deriving(Clone, PartialEq, TotalEq, Hash, Encodable, Decodable, Show)] pub enum DefRegion { DefStaticRegion, DefEarlyBoundRegion(/* index */ uint, /* lifetime decl */ NodeId), @@ -261,7 +261,7 @@ pub enum DefRegion { // used to drive conditional compilation pub type CrateConfig = Vec<@MetaItem> ; -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct Crate { pub module: Mod, pub attrs: Vec<Attribute>, @@ -279,7 +279,7 @@ pub enum MetaItem_ { } // can't be derived because the MetaList requires an unordered comparison -impl Eq for MetaItem_ { +impl PartialEq for MetaItem_ { fn eq(&self, other: &MetaItem_) -> bool { match *self { MetaWord(ref ns) => match *other { @@ -303,7 +303,7 @@ impl Eq for MetaItem_ { } } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct Block { pub view_items: Vec<ViewItem>, pub stmts: Vec<@Stmt>, @@ -313,26 +313,26 @@ pub struct Block { pub span: Span, } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct Pat { pub id: NodeId, pub node: Pat_, pub span: Span, } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct FieldPat { pub ident: Ident, pub pat: @Pat, } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum BindingMode { BindByRef(Mutability), BindByValue(Mutability), } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum Pat_ { PatWild, PatWildMulti, @@ -358,20 +358,20 @@ pub enum Pat_ { PatMac(Mac), } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash, Show)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash, Show)] pub enum Mutability { MutMutable, MutImmutable, } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum ExprVstore { ExprVstoreUniq, // ~[1,2,3,4] ExprVstoreSlice, // &[1,2,3,4] ExprVstoreMutSlice, // &mut [1,2,3,4] } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum BinOp { BiAdd, BiSub, @@ -393,7 +393,7 @@ pub enum BinOp { BiGt, } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum UnOp { UnBox, UnUniq, @@ -404,7 +404,7 @@ pub enum UnOp { pub type Stmt = Spanned<Stmt_>; -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum Stmt_ { // could be an item or a local (let) binding: StmtDecl(@Decl, NodeId), @@ -421,7 +421,7 @@ pub enum Stmt_ { /// Where a local declaration came from: either a true `let ... = /// ...;`, or one desugared from the pattern of a for loop. -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum LocalSource { LocalLet, LocalFor, @@ -430,7 +430,7 @@ pub enum LocalSource { // FIXME (pending discussion of #1697, #2178...): local should really be // a refinement on pat. /// Local represents a `let` statement, e.g., `let <pat>:<ty> = <expr>;` -#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct Local { pub ty: P<Ty>, pub pat: @Pat, @@ -442,7 +442,7 @@ pub struct Local { pub type Decl = Spanned<Decl_>; -#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum Decl_ { // a local (let) binding: DeclLocal(@Local), @@ -450,7 +450,7 @@ pub enum Decl_ { DeclItem(@Item), } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct Arm { pub attrs: Vec<Attribute>, pub pats: Vec<@Pat>, @@ -458,7 +458,7 @@ pub struct Arm { pub body: @Expr, } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct Field { pub ident: SpannedIdent, pub expr: @Expr, @@ -467,26 +467,26 @@ pub struct Field { pub type SpannedIdent = Spanned<Ident>; -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum BlockCheckMode { DefaultBlock, UnsafeBlock(UnsafeSource), } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum UnsafeSource { CompilerGenerated, UserProvided, } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct Expr { pub id: NodeId, pub node: Expr_, pub span: Span, } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum Expr_ { ExprVstore(@Expr, ExprVstore), // First expr is the place; second expr is the value. @@ -555,7 +555,7 @@ pub enum Expr_ { // else knows what to do with them, so you'll probably get a syntax // error. // -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] #[doc="For macro invocations; parsing is delegated to the macro"] pub enum TokenTree { // a single token @@ -631,7 +631,7 @@ pub enum TokenTree { // pub type Matcher = Spanned<Matcher_>; -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum Matcher_ { // match one token MatchTok(::parse::token::Token), @@ -648,12 +648,12 @@ pub type Mac = Spanned<Mac_>; // is being invoked, and the vector of token-trees contains the source // of the macro invocation. // There's only one flavor, now, so this could presumably be simplified. -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum Mac_ { MacInvocTT(Path, Vec<TokenTree> , SyntaxContext), // new macro-invocation } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum StrStyle { CookedStr, RawStr(uint) @@ -661,7 +661,7 @@ pub enum StrStyle { pub type Lit = Spanned<Lit_>; -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum Lit_ { LitStr(InternedString, StrStyle), LitBinary(Rc<Vec<u8> >), @@ -677,20 +677,20 @@ pub enum Lit_ { // NB: If you change this, you'll probably want to change the corresponding // type structure in middle/ty.rs as well. -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct MutTy { pub ty: P<Ty>, pub mutbl: Mutability, } -#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct TypeField { pub ident: Ident, pub mt: MutTy, pub span: Span, } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct TypeMethod { pub ident: Ident, pub attrs: Vec<Attribute>, @@ -706,13 +706,13 @@ pub struct TypeMethod { // A trait method is either required (meaning it doesn't have an // implementation, just a signature) or provided (meaning it has a default // implementation). -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum TraitMethod { Required(TypeMethod), Provided(@Method), } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum IntTy { TyI, TyI8, @@ -728,7 +728,7 @@ impl fmt::Show for IntTy { } } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum UintTy { TyU, TyU8, @@ -744,7 +744,7 @@ impl fmt::Show for UintTy { } } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum FloatTy { TyF32, TyF64, @@ -757,8 +757,8 @@ impl fmt::Show for FloatTy { } } -// NB Eq method appears below. -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +// NB PartialEq method appears below. +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct Ty { pub id: NodeId, pub node: Ty_, @@ -766,7 +766,7 @@ pub struct Ty { } // Not represented directly in the AST, referred to by name through a ty_path. -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum PrimTy { TyInt(IntTy), TyUint(UintTy), @@ -776,7 +776,7 @@ pub enum PrimTy { TyChar } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum Onceness { Once, Many @@ -791,7 +791,7 @@ impl fmt::Show for Onceness { } } -#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct ClosureTy { pub lifetimes: Vec<Lifetime>, pub fn_style: FnStyle, @@ -804,7 +804,7 @@ pub struct ClosureTy { pub bounds: Option<OwnedSlice<TyParamBound>>, } -#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct BareFnTy { pub fn_style: FnStyle, pub abi: Abi, @@ -812,7 +812,7 @@ pub struct BareFnTy { pub decl: P<FnDecl> } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum Ty_ { TyNil, TyBot, /* bottom type */ @@ -833,13 +833,13 @@ pub enum Ty_ { TyInfer, } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum AsmDialect { AsmAtt, AsmIntel } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct InlineAsm { pub asm: InternedString, pub asm_str_style: StrStyle, @@ -851,7 +851,7 @@ pub struct InlineAsm { pub dialect: AsmDialect } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct Arg { pub ty: P<Ty>, pub pat: @Pat, @@ -878,7 +878,7 @@ impl Arg { } } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct FnDecl { pub inputs: Vec<Arg>, pub output: P<Ty>, @@ -886,7 +886,7 @@ pub struct FnDecl { pub variadic: bool } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum FnStyle { UnsafeFn, // declared with "unsafe fn" NormalFn, // declared with "fn" @@ -901,14 +901,14 @@ impl fmt::Show for FnStyle { } } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum RetStyle { NoReturn, // functions with return type _|_ that always // raise an error or exit (i.e. never return to the caller) Return, // everything else } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum ExplicitSelf_ { SelfStatic, // no self SelfValue, // `self` @@ -918,7 +918,7 @@ pub enum ExplicitSelf_ { pub type ExplicitSelf = Spanned<ExplicitSelf_>; -#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct Method { pub ident: Ident, pub attrs: Vec<Attribute>, @@ -932,7 +932,7 @@ pub struct Method { pub vis: Visibility, } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct Mod { /// A span from the first token past `{` to the last token until `}`. /// For `mod foo;`, the inner span ranges from the first token @@ -942,31 +942,31 @@ pub struct Mod { pub items: Vec<@Item>, } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct ForeignMod { pub abi: Abi, pub view_items: Vec<ViewItem>, pub items: Vec<@ForeignItem>, } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct VariantArg { pub ty: P<Ty>, pub id: NodeId, } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum VariantKind { TupleVariantKind(Vec<VariantArg>), StructVariantKind(@StructDef), } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct EnumDef { pub variants: Vec<P<Variant>>, } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct Variant_ { pub name: Ident, pub attrs: Vec<Attribute>, @@ -978,7 +978,7 @@ pub struct Variant_ { pub type Variant = Spanned<Variant_>; -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct PathListIdent_ { pub name: Ident, pub id: NodeId, @@ -988,7 +988,7 @@ pub type PathListIdent = Spanned<PathListIdent_>; pub type ViewPath = Spanned<ViewPath_>; -#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum ViewPath_ { // quux = foo::bar::baz @@ -1005,7 +1005,7 @@ pub enum ViewPath_ { ViewPathList(Path, Vec<PathListIdent> , NodeId) } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct ViewItem { pub node: ViewItem_, pub attrs: Vec<Attribute>, @@ -1013,7 +1013,7 @@ pub struct ViewItem { pub span: Span, } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum ViewItem_ { // ident: name used to refer to this crate in the code // optional (InternedString,StrStyle): if present, this is a location @@ -1029,17 +1029,17 @@ pub type Attribute = Spanned<Attribute_>; // Distinguishes between Attributes that decorate items and Attributes that // are contained as statements within items. These two cases need to be // distinguished for pretty-printing. -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum AttrStyle { AttrOuter, AttrInner, } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct AttrId(pub uint); // doc-comments are promoted to attributes that have is_sugared_doc = true -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct Attribute_ { pub id: AttrId, pub style: AttrStyle, @@ -1054,13 +1054,13 @@ pub struct Attribute_ { If this impl is an ItemImpl, the impl_id is redundant (it could be the same as the impl's node id). */ -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct TraitRef { pub path: Path, pub ref_id: NodeId, } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum Visibility { Public, Inherited, @@ -1075,13 +1075,13 @@ impl Visibility { } } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum Sized { DynSize, StaticSize, } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct StructField_ { pub kind: StructFieldKind, pub id: NodeId, @@ -1091,7 +1091,7 @@ pub struct StructField_ { pub type StructField = Spanned<StructField_>; -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum StructFieldKind { NamedField(Ident, Visibility), UnnamedField(Visibility), // element of a tuple-like struct @@ -1106,7 +1106,7 @@ impl StructFieldKind { } } -#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct StructDef { pub fields: Vec<StructField>, /* fields, not including ctor */ /* ID of the constructor. This is only used for tuple- or enum-like @@ -1120,7 +1120,7 @@ pub struct StructDef { FIXME (#3300): Should allow items to be anonymous. Right now we just use dummy names for anon items. */ -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct Item { pub ident: Ident, pub attrs: Vec<Attribute>, @@ -1130,7 +1130,7 @@ pub struct Item { pub span: Span, } -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum Item_ { ItemStatic(P<Ty>, Mutability, @Expr), ItemFn(P<FnDecl>, FnStyle, Abi, Generics, P<Block>), @@ -1148,7 +1148,7 @@ pub enum Item_ { ItemMac(Mac), } -#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct ForeignItem { pub ident: Ident, pub attrs: Vec<Attribute>, @@ -1158,7 +1158,7 @@ pub struct ForeignItem { pub vis: Visibility, } -#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum ForeignItem_ { ForeignItemFn(P<FnDecl>, Generics), ForeignItemStatic(P<Ty>, /* is_mutbl */ bool), @@ -1167,7 +1167,7 @@ pub enum ForeignItem_ { // The data we save and restore about an inlined item or method. This is not // part of the AST that we parse from a file, but it becomes part of the tree // that we trans. -#[deriving(Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)] pub enum InlinedItem { IIItem(@Item), IIMethod(DefId /* impl id */, bool /* is provided */, @Method), diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs index 6b81f8ee2e1..9a7b4f7d949 100644 --- a/src/libsyntax/ast_map.rs +++ b/src/libsyntax/ast_map.rs @@ -24,7 +24,7 @@ use std::iter; use std::slice; use std::string::String; -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub enum PathElem { PathMod(Name), PathName(Name) diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index 527e851ae35..4a38835f86b 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -307,7 +307,7 @@ pub fn find_crateid(attrs: &[Attribute]) -> Option<CrateId> { } } -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum InlineAttr { InlineNone, InlineHint, @@ -396,7 +396,7 @@ pub struct Stability { } /// The available stability levels. -#[deriving(Eq,Ord,Clone,Show)] +#[deriving(PartialEq,PartialOrd,Clone,Show)] pub enum StabilityLevel { Deprecated, Experimental, @@ -522,7 +522,7 @@ fn int_type_of_word(s: &str) -> Option<IntType> { } } -#[deriving(Eq, Show)] +#[deriving(PartialEq, Show)] pub enum ReprAttr { ReprAny, ReprInt(Span, IntType), @@ -539,7 +539,7 @@ impl ReprAttr { } } -#[deriving(Eq, Show)] +#[deriving(PartialEq, Show)] pub enum IntType { SignedInt(ast::IntTy), UnsignedInt(ast::UintTy) diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index 1ef7576335b..59bf9608a09 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -33,13 +33,13 @@ pub trait Pos { /// A byte offset. Keep this small (currently 32-bits), as AST contains /// a lot of them. -#[deriving(Clone, Eq, TotalEq, Hash, Ord, Show)] +#[deriving(Clone, PartialEq, TotalEq, Hash, PartialOrd, Show)] pub struct BytePos(pub u32); /// 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, Hash, Ord, Show)] +#[deriving(PartialEq, Hash, PartialOrd, Show)] pub struct CharPos(pub uint); // FIXME: Lots of boilerplate in these impls, but so far my attempts to fix @@ -96,13 +96,13 @@ pub struct Span { pub static DUMMY_SP: Span = Span { lo: BytePos(0), hi: BytePos(0), expn_info: None }; -#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)] +#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)] pub struct Spanned<T> { pub node: T, pub span: Span, } -impl Eq for Span { +impl PartialEq for Span { fn eq(&self, other: &Span) -> bool { return (*self).lo == (*other).lo && (*self).hi == (*other).hi; } diff --git a/src/libsyntax/crateid.rs b/src/libsyntax/crateid.rs index 329ddcad461..3f74598d2e5 100644 --- a/src/libsyntax/crateid.rs +++ b/src/libsyntax/crateid.rs @@ -20,7 +20,7 @@ use std::fmt; use std::from_str::FromStr; -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub struct CrateId { /// A path which represents the codes origin. By convention this is the /// URL, without `http://` or `https://` prefix, to the crate's repository diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs index 49da91e1053..ee06efbec13 100644 --- a/src/libsyntax/diagnostic.rs +++ b/src/libsyntax/diagnostic.rs @@ -194,7 +194,7 @@ pub fn mk_handler(e: Box<Emitter:Send>) -> Handler { } } -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum Level { Bug, Fatal, diff --git a/src/libsyntax/ext/deriving/generic/mod.rs b/src/libsyntax/ext/deriving/generic/mod.rs index 0f4af144ead..e2290129dc8 100644 --- a/src/libsyntax/ext/deriving/generic/mod.rs +++ b/src/libsyntax/ext/deriving/generic/mod.rs @@ -24,7 +24,7 @@ Supported features (fairly exhaustive): current trait as a bound. (This includes separate type parameters and lifetimes for methods.) - Additional bounds on the type parameters, e.g. the `Ord` instance - requires an explicit `Eq` bound at the + requires an explicit `PartialEq` bound at the moment. (`TraitDef.additional_bounds`) Unsupported: FIXME #6257: calling methods on reference fields, @@ -82,13 +82,13 @@ variants, it is represented as a count of 0. # Examples -The following simplified `Eq` is used for in-code examples: +The following simplified `PartialEq` is used for in-code examples: ```rust -trait Eq { +trait PartialEq { fn eq(&self, other: &Self); } -impl Eq for int { +impl PartialEq for int { fn eq(&self, other: &int) -> bool { *self == *other } @@ -96,7 +96,7 @@ impl Eq for int { ``` Some examples of the values of `SubstructureFields` follow, using the -above `Eq`, `A`, `B` and `C`. +above `PartialEq`, `A`, `B` and `C`. ## Structs @@ -645,11 +645,11 @@ impl<'a> MethodDef<'a> { /** ~~~ - #[deriving(Eq)] + #[deriving(PartialEq)] struct A { x: int, y: int } // equivalent to: - impl Eq for A { + impl PartialEq for A { fn eq(&self, __arg_1: &A) -> bool { match *self { A {x: ref __self_0_0, y: ref __self_0_1} => { @@ -750,7 +750,7 @@ impl<'a> MethodDef<'a> { /** ~~~ - #[deriving(Eq)] + #[deriving(PartialEq)] enum A { A1 A2(int) @@ -758,7 +758,7 @@ impl<'a> MethodDef<'a> { // is equivalent to (with const_nonmatching == false) - impl Eq for A { + impl PartialEq for A { fn eq(&self, __arg_1: &A) { match *self { A1 => match *__arg_1 { @@ -994,7 +994,7 @@ impl<'a> MethodDef<'a> { } } -#[deriving(Eq)] // dogfooding! +#[deriving(PartialEq)] // dogfooding! enum StructType { Unknown, Record, Tuple } diff --git a/src/libsyntax/ext/deriving/mod.rs b/src/libsyntax/ext/deriving/mod.rs index e5da7330a6c..3735248e9e2 100644 --- a/src/libsyntax/ext/deriving/mod.rs +++ b/src/libsyntax/ext/deriving/mod.rs @@ -77,10 +77,9 @@ pub fn expand_meta_deriving(cx: &mut ExtCtxt, "Encodable" => expand!(encodable::expand_deriving_encodable), "Decodable" => expand!(decodable::expand_deriving_decodable), - // NOTE this needs treatment after a stage0 snap - "PartialEq" | "Eq" => expand!(eq::expand_deriving_eq), + "PartialEq" => expand!(eq::expand_deriving_eq), "TotalEq" => expand!(totaleq::expand_deriving_totaleq), - "PartialOrd" | "Ord" => expand!(ord::expand_deriving_ord), + "PartialOrd" => expand!(ord::expand_deriving_ord), "TotalOrd" => expand!(totalord::expand_deriving_totalord), "Rand" => expand!(rand::expand_deriving_rand), diff --git a/src/libsyntax/ext/format.rs b/src/libsyntax/ext/format.rs index c05fc8ce6d9..0d228a1146d 100644 --- a/src/libsyntax/ext/format.rs +++ b/src/libsyntax/ext/format.rs @@ -21,7 +21,7 @@ use rsparse = parse; use parse = fmt_macros; use collections::{HashMap, HashSet}; -#[deriving(Eq)] +#[deriving(PartialEq)] enum ArgumentType { Known(String), Unsigned, diff --git a/src/libsyntax/ext/mtwt.rs b/src/libsyntax/ext/mtwt.rs index fdaa3b5630a..12e314781ae 100644 --- a/src/libsyntax/ext/mtwt.rs +++ b/src/libsyntax/ext/mtwt.rs @@ -37,7 +37,7 @@ pub struct SCTable { rename_memo: RefCell<HashMap<(SyntaxContext,Ident,Name),SyntaxContext>>, } -#[deriving(Eq, Encodable, Decodable, Hash)] +#[deriving(PartialEq, Encodable, Decodable, Hash)] pub enum SyntaxContext_ { EmptyCtxt, Mark (Mrk,SyntaxContext), @@ -294,7 +294,7 @@ mod tests { // because of the SCTable, I now need a tidy way of // creating syntax objects. Sigh. - #[deriving(Clone, Eq, Show)] + #[deriving(Clone, PartialEq, Show)] enum TestSC { M(Mrk), R(Ident,Name) diff --git a/src/libsyntax/owned_slice.rs b/src/libsyntax/owned_slice.rs index f93c3576943..c04c10e0d72 100644 --- a/src/libsyntax/owned_slice.rs +++ b/src/libsyntax/owned_slice.rs @@ -113,7 +113,7 @@ impl<S: Writer, T: Hash<S>> Hash<S> for OwnedSlice<T> { } } -impl<T: Eq> Eq for OwnedSlice<T> { +impl<T: PartialEq> PartialEq for OwnedSlice<T> { fn eq(&self, other: &OwnedSlice<T>) -> bool { self.as_slice() == other.as_slice() } diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs index cc08cb429f5..622ed6b9801 100644 --- a/src/libsyntax/parse/comments.rs +++ b/src/libsyntax/parse/comments.rs @@ -22,7 +22,7 @@ use std::str; use std::string::String; use std::uint; -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub enum CommentStyle { Isolated, // No code on either side of each line of the comment Trailing, // Code exists to the left of the comment diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index fb67a76b85b..f5386b43d51 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -34,7 +34,7 @@ pub trait Reader { fn peek(&self) -> TokenAndSpan; } -#[deriving(Clone, Eq, Show)] +#[deriving(Clone, PartialEq, Show)] pub struct TokenAndSpan { pub tok: token::Token, pub sp: Span, diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs index f045a7fe120..b7121c6b32c 100644 --- a/src/libsyntax/parse/obsolete.rs +++ b/src/libsyntax/parse/obsolete.rs @@ -23,7 +23,7 @@ use parse::parser; use parse::token; /// The specific types of unsupported syntax -#[deriving(Eq, TotalEq, Hash)] +#[deriving(PartialEq, TotalEq, Hash)] pub enum ObsoleteSyntax { ObsoleteOwnedType, ObsoleteOwnedExpr, diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 00c07ce59f9..6c09fa20510 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -82,7 +82,7 @@ use std::rc::Rc; use std::string::String; #[allow(non_camel_case_types)] -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum restriction { UNRESTRICTED, RESTRICT_STMT_EXPR, @@ -94,7 +94,7 @@ type ItemInfo = (Ident, Item_, Option<Vec<Attribute> >); /// How to parse a path. There are four different kinds of paths, all of which /// are parsed somewhat differently. -#[deriving(Eq)] +#[deriving(PartialEq)] pub enum PathParsingMode { /// A path with no type parameters; e.g. `foo::bar::Baz` NoTypesAllowed, diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 2c090d053a3..192adfe7829 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -24,7 +24,7 @@ use std::rc::Rc; use std::string::String; #[allow(non_camel_case_types)] -#[deriving(Clone, Encodable, Decodable, Eq, TotalEq, Hash, Show)] +#[deriving(Clone, Encodable, Decodable, PartialEq, TotalEq, Hash, Show)] pub enum BinOp { PLUS, MINUS, @@ -39,7 +39,7 @@ pub enum BinOp { } #[allow(non_camel_case_types)] -#[deriving(Clone, Encodable, Decodable, Eq, TotalEq, Hash, Show)] +#[deriving(Clone, Encodable, Decodable, PartialEq, TotalEq, Hash, Show)] pub enum Token { /* Expression-operator symbols. */ EQ, @@ -102,7 +102,7 @@ pub enum Token { EOF, } -#[deriving(Clone, Encodable, Decodable, Eq, TotalEq, Hash)] +#[deriving(Clone, Encodable, Decodable, PartialEq, TotalEq, Hash)] /// For interpolation during macro expansion. pub enum Nonterminal { NtItem(@ast::Item), @@ -552,7 +552,7 @@ pub fn get_ident_interner() -> Rc<IdentInterner> { /// destroyed. In particular, they must not access string contents. This can /// be fixed in the future by just leaking all strings until task death /// somehow. -#[deriving(Clone, Eq, Hash, Ord, TotalEq, TotalOrd)] +#[deriving(Clone, PartialEq, Hash, PartialOrd, TotalEq, TotalOrd)] pub struct InternedString { string: RcStr, } diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs index 669378b313a..ec9ca655064 100644 --- a/src/libsyntax/print/pp.rs +++ b/src/libsyntax/print/pp.rs @@ -64,7 +64,7 @@ use std::io; use std::string::String; -#[deriving(Clone, Eq)] +#[deriving(Clone, PartialEq)] pub enum Breaks { Consistent, Inconsistent, diff --git a/src/libsyntax/util/interner.rs b/src/libsyntax/util/interner.rs index 72600921ba9..d2361810a24 100644 --- a/src/libsyntax/util/interner.rs +++ b/src/libsyntax/util/interner.rs @@ -90,7 +90,7 @@ impl<T: TotalEq + Hash + Clone + 'static> Interner<T> { } } -#[deriving(Clone, Eq, Hash, Ord)] +#[deriving(Clone, PartialEq, Hash, PartialOrd)] pub struct RcStr { string: Rc<String>, } |
