diff --git a/src/librustc/hir/def_id.rs b/src/librustc/hir/def_id.rs index 34b3aa53d6bcf807e0e818ad4eef538128942bfb..7acfe6839540b5ebd2c57e676a63c6d5724ad9f3 100644 --- a/src/librustc/hir/def_id.rs +++ b/src/librustc/hir/def_id.rs @@ -81,7 +81,7 @@ impl serialize::UseSpecializedDecodable for CrateNum {} /// Since the DefIndex is mostly treated as an opaque ID, you probably /// don't have to care about these address spaces. -#[derive(Clone, Eq, Ord, PartialOrd, PartialEq, Hash, Copy)] +#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Copy)] pub struct DefIndex(u32); /// The crate root is always assigned index 0 by the AST Map code, @@ -150,7 +150,7 @@ pub fn as_raw_u32(&self) -> u32 { impl serialize::UseSpecializedEncodable for DefIndex {} impl serialize::UseSpecializedDecodable for DefIndex {} -#[derive(Copy, Clone, Eq, PartialEq, Hash)] +#[derive(Copy, Clone, Hash)] pub enum DefIndexAddressSpace { Low = 0, High = 1, @@ -165,7 +165,7 @@ pub fn index(&self) -> usize { /// A DefId identifies a particular *definition*, by combining a crate /// index and a def index. -#[derive(Clone, Eq, Ord, PartialOrd, PartialEq, Hash, Copy)] +#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Copy)] pub struct DefId { pub krate: CrateNum, pub index: DefIndex, @@ -216,7 +216,7 @@ impl serialize::UseSpecializedDecodable for DefId {} /// few cases where we know that only DefIds from the local crate are expected /// and a DefId from a different crate would signify a bug somewhere. This /// is when LocalDefId comes in handy. -#[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Hash)] +#[derive(Clone, Copy, PartialEq, Eq, Hash)] pub struct LocalDefId(DefIndex); impl LocalDefId { diff --git a/src/librustc/hir/intravisit.rs b/src/librustc/hir/intravisit.rs index a7ed854d016494584fe4009e89b83af3fcc83a26..e2c0020db2ff346ee50de183a6809d1b5728ed47 100644 --- a/src/librustc/hir/intravisit.rs +++ b/src/librustc/hir/intravisit.rs @@ -51,7 +51,7 @@ use std::cmp; use std::u32; -#[derive(Copy, Clone, PartialEq, Eq)] +#[derive(Copy, Clone)] pub enum FnKind<'a> { /// #[xxx] pub async/const/extern "Abi" fn foo() ItemFn(Name, &'a Generics, FnHeader, &'a Visibility, &'a [Attribute]), @@ -1115,7 +1115,7 @@ pub fn walk_defaultness<'v, V: Visitor<'v>>(_: &mut V, _: &'v Defaultness) { // would be to walk it. } -#[derive(Copy, Clone, RustcEncodable, RustcDecodable, Debug, PartialEq, Eq)] +#[derive(Copy, Clone, RustcEncodable, RustcDecodable, Debug)] pub struct IdRange { pub min: NodeId, pub max: NodeId, diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index 7dd7954c8f439f0fea9e6c4349bff201f26aa411..cb53f963d41f10c27d6686097dfe792ee4111173 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -238,7 +238,7 @@ pub fn lower_crate( }.lower_crate(krate) } -#[derive(Copy, Clone, PartialEq, Eq)] +#[derive(Copy, Clone, PartialEq)] enum ParamMode { /// Any path in a type context. Explicit, @@ -1927,7 +1927,7 @@ fn lower_fn_decl( variadic: decl.variadic, has_implicit_self: decl.inputs.get(0).map_or(false, |arg| match arg.ty.node { TyKind::ImplicitSelf => true, - TyKind::Rptr(_, ref mt) => mt.ty.node == TyKind::ImplicitSelf, + TyKind::Rptr(_, ref mt) => mt.ty.node.is_implicit_self(), _ => false, }), }) diff --git a/src/librustc/hir/map/definitions.rs b/src/librustc/hir/map/definitions.rs index 49a4a1b78a1a8714edf8d7808b6870e2fe04f19b..9b1bb3310f2fd3807b88235eb1412e40ec3a9648 100644 --- a/src/librustc/hir/map/definitions.rs +++ b/src/librustc/hir/map/definitions.rs @@ -171,7 +171,7 @@ pub struct Definitions { /// A unique identifier that we can use to lookup a definition /// precisely. It combines the index of the definition's parent (if /// any) with a `DisambiguatedDefPathData`. -#[derive(Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] +#[derive(Clone, PartialEq, Debug, Hash, RustcEncodable, RustcDecodable)] pub struct DefKey { /// Parent path. pub parent: Option, @@ -223,13 +223,13 @@ fn root_parent_stable_hash(crate_name: &str, /// between them. This introduces some artificial ordering dependency /// but means that if you have (e.g.) two impls for the same type in /// the same module, they do get distinct def-ids. -#[derive(Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] +#[derive(Clone, PartialEq, Debug, Hash, RustcEncodable, RustcDecodable)] pub struct DisambiguatedDefPathData { pub data: DefPathData, pub disambiguator: u32 } -#[derive(Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] +#[derive(Clone, Debug, Hash, RustcEncodable, RustcDecodable)] pub struct DefPath { /// the path leading from the crate root to the item pub data: Vec, @@ -311,7 +311,7 @@ pub fn to_filename_friendly_no_crate(&self) -> String { } } -#[derive(Clone, Debug, Eq, PartialEq, Hash, RustcEncodable, RustcDecodable)] +#[derive(Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)] pub enum DefPathData { // Root: these should only be used for the root nodes, because // they are treated specially by the `def_path` function. @@ -668,8 +668,7 @@ pub fn to_string(&self) -> String { (pub enum GlobalMetaDataKind { $($variant:ident),* }) => ( - #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, - RustcEncodable, RustcDecodable)] + #[derive(Clone, Copy, Debug, Hash, RustcEncodable, RustcDecodable)] pub enum GlobalMetaDataKind { $($variant),* } diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index bae443bfc582403a036c732964b20ad4cd19f811..e98e9b1760351e89d269ab7a698596f979f23585 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -89,7 +89,7 @@ /// the local_id part of the HirId changing, which is a very useful property in /// incremental compilation where we have to persist things through changes to /// the code base. -#[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Debug)] +#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)] pub struct HirId { pub owner: DefIndex, pub local_id: ItemLocalId, @@ -138,7 +138,7 @@ fn default_decode(d: &mut D) -> Result { /// integers starting at zero, so a mapping that maps all or most nodes within /// an "item-like" to something else can be implement by a `Vec` instead of a /// tree or hash map. -#[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Debug, +#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, RustcEncodable, RustcDecodable)] pub struct ItemLocalId(pub u32); @@ -172,7 +172,7 @@ fn index(self) -> usize { pub const DUMMY_ITEM_LOCAL_ID: ItemLocalId = ItemLocalId(!0); -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)] +#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Copy)] pub struct Label { pub ident: Ident, } @@ -183,7 +183,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { } } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)] +#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Copy)] pub struct Lifetime { pub id: NodeId, pub span: Span, @@ -312,7 +312,7 @@ pub fn is_static(&self) -> bool { /// A "Path" is essentially Rust's notion of a name; for instance: /// `std::cmp::PartialEq`. It's represented as a sequence of identifiers, /// along with a bunch of supporting information. -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash)] +#[derive(Clone, RustcEncodable, RustcDecodable, Hash)] pub struct Path { pub span: Span, /// The definition that the path resolved to. @@ -341,7 +341,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { /// A segment of a path: an identifier, an optional lifetime, and a set of /// types. -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct PathSegment { /// The identifier portion of this path segment. pub ident: Ident, @@ -396,7 +396,7 @@ pub fn with_generic_args(&self, f: F) -> R } } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum GenericArg { Lifetime(Lifetime), Type(Ty), @@ -411,7 +411,7 @@ pub fn span(&self) -> Span { } } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct GenericArgs { /// The generic arguments for this path segment. pub args: HirVec, @@ -467,7 +467,7 @@ pub enum TraitBoundModifier { /// typeck::collect::compute_bounds matches these against /// the "special" built-in traits (see middle::lang_items) and /// detects Copy, Send and Sync. -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum GenericBound { Trait(PolyTraitRef, TraitBoundModifier), Outlives(Lifetime), @@ -484,7 +484,7 @@ pub fn span(&self) -> Span { pub type GenericBounds = HirVec; -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum GenericParamKind { /// A lifetime definition, eg `'a: 'b + 'c + 'd`. Lifetime { @@ -499,7 +499,7 @@ pub enum GenericParamKind { } } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct GenericParam { pub id: NodeId, pub name: ParamName, @@ -518,7 +518,7 @@ pub struct GenericParamCount { /// Represents lifetimes and type parameters attached to a declaration /// of a function, enum, trait, etc. -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct Generics { pub params: HirVec, pub where_clause: WhereClause, @@ -568,13 +568,13 @@ pub fn get_named(&self, name: &InternedString) -> Option<&GenericParam> { /// Synthetic Type Parameters are converted to an other form during lowering, this allows /// to track the original form they had. Useful for error messages. -#[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum SyntheticTyParamKind { ImplTrait } /// A `where` clause in a definition -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct WhereClause { pub id: NodeId, pub predicates: HirVec, @@ -593,7 +593,7 @@ pub fn span(&self) -> Option { } /// A single predicate in a `where` clause -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum WherePredicate { /// A type binding, eg `for<'c> Foo: Send+Clone+'c` BoundPredicate(WhereBoundPredicate), @@ -614,7 +614,7 @@ pub fn span(&self) -> Span { } /// A type bound, eg `for<'c> Foo: Send+Clone+'c` -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct WhereBoundPredicate { pub span: Span, /// Any generics from a `for` binding @@ -626,7 +626,7 @@ pub struct WhereBoundPredicate { } /// A lifetime predicate, e.g. `'a: 'b+'c` -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct WhereRegionPredicate { pub span: Span, pub lifetime: Lifetime, @@ -634,7 +634,7 @@ pub struct WhereRegionPredicate { } /// An equality predicate (unsupported), e.g. `T=int` -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct WhereEqPredicate { pub id: NodeId, pub span: Span, @@ -650,7 +650,7 @@ pub struct WhereEqPredicate { /// For more details, see the [rustc guide]. /// /// [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/hir.html -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Debug)] pub struct Crate { pub module: Mod, pub attrs: HirVec, @@ -748,7 +748,7 @@ pub fn body(&self, id: BodyId) -> &Body { /// A macro definition, in this crate or imported from another. /// /// Not parsed directly, but created on macro import or `macro_rules!` expansion. -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct MacroDef { pub name: Name, pub vis: Visibility, @@ -759,7 +759,7 @@ pub struct MacroDef { pub legacy: bool, } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct Block { /// Statements in a block pub stmts: HirVec, @@ -782,7 +782,7 @@ pub struct Block { pub recovered: bool, } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash)] +#[derive(Clone, RustcEncodable, RustcDecodable, Hash)] pub struct Pat { pub id: NodeId, pub hir_id: HirId, @@ -844,7 +844,7 @@ pub fn walk(&self, mut it: F) -> bool /// Patterns like the fields of Foo `{ x, ref y, ref mut z }` /// are treated the same as` x: x, y: ref y, z: ref mut z`, /// except is_shorthand is true -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct FieldPat { pub id: NodeId, /// The identifier for the field @@ -857,7 +857,7 @@ pub struct FieldPat { /// Explicit binding annotations given in the HIR for a binding. Note /// that this is not the final binding *mode* that we infer after type /// inference. -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] +#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub enum BindingAnnotation { /// No binding annotation given: this means that the final binding mode /// will depend on whether we have skipped through a `&` reference @@ -878,13 +878,13 @@ pub enum BindingAnnotation { RefMut, } -#[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum RangeEnd { Included, Excluded, } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum PatKind { /// Represents a wildcard pattern (`_`) Wild, @@ -940,7 +940,7 @@ pub fn and(self, other: Self) -> Self { } } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] +#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub enum BinOp_ { /// The `+` operator (addition) BiAdd, @@ -1069,7 +1069,7 @@ fn into(self) -> ast::BinOpKind { pub type BinOp = Spanned; -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] +#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub enum UnOp { /// The `*` operator for dereferencing UnDeref, @@ -1111,7 +1111,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { } } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash)] +#[derive(Clone, RustcEncodable, RustcDecodable, Hash)] pub enum Stmt_ { /// Could be an item or a local (let) binding: StmtDecl(P, NodeId), @@ -1142,7 +1142,7 @@ pub fn id(&self) -> NodeId { } /// Local represents a `let` statement, e.g., `let : = ;` -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct Local { pub pat: P, pub ty: Option>, @@ -1157,7 +1157,7 @@ pub struct Local { pub type Decl = Spanned; -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum Decl_ { /// A local (let) binding: DeclLocal(P), @@ -1182,7 +1182,7 @@ pub fn is_local(&self) -> bool { } /// represents one arm of a 'match' -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct Arm { pub attrs: HirVec, pub pats: HirVec>, @@ -1190,7 +1190,7 @@ pub struct Arm { pub body: P, } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct Field { pub id: NodeId, pub ident: Ident, @@ -1199,7 +1199,7 @@ pub struct Field { pub is_shorthand: bool, } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] +#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub enum BlockCheckMode { DefaultBlock, UnsafeBlock(UnsafeSource), @@ -1207,7 +1207,7 @@ pub enum BlockCheckMode { PopUnsafeBlock(UnsafeSource), } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] +#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub enum UnsafeSource { CompilerGenerated, UserProvided, @@ -1239,7 +1239,7 @@ pub struct BodyId { /// /// All bodies have an **owner**, which can be accessed via the HIR /// map using `body_owner_def_id()`. -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct Body { pub arguments: HirVec, pub value: Expr, @@ -1279,7 +1279,7 @@ pub struct AnonConst { } /// An expression -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash)] +#[derive(Clone, RustcEncodable, RustcDecodable, Hash)] pub struct Expr { pub id: NodeId, pub span: Span, @@ -1330,7 +1330,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { } } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum Expr_ { /// A `box x` expression. ExprBox(P), @@ -1432,7 +1432,7 @@ pub enum Expr_ { } /// Optionally `Self`-qualified value/type path or associated extension. -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum QPath { /// Path to a definition, optionally "fully-qualified" with a `Self` /// type, if the path points to an associated item in a trait. @@ -1452,7 +1452,7 @@ pub enum QPath { } /// Hints at the original code for a let statement -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] +#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub enum LocalSource { /// A `match _ { .. }` Normal, @@ -1479,7 +1479,7 @@ pub enum MatchSource { } /// The loop type that yielded an ExprLoop -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] +#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub enum LoopSource { /// A `loop { .. }` loop Loop, @@ -1489,7 +1489,7 @@ pub enum LoopSource { ForLoop, } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] +#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub enum LoopIdError { OutsideLoopScope, UnlabeledCfInWhileCondition, @@ -1507,7 +1507,6 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { } } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)] pub struct Destination { // This is `Some(_)` iff there is an explicit user-specified `label pub label: Option