Skip to content

Commit 0db03e6

Browse files
committed
Auto merge of #51829 - petrochenkov:noideq, r=eddyb
Remove most of `PartialEq` and `Hash` impls from AST and HIR structures Continuation of #49326, prerequisite for removing `PartialEq` for `Ident`.
2 parents 1731f0a + 7d142c1 commit 0db03e6

File tree

39 files changed

+365
-595
lines changed

39 files changed

+365
-595
lines changed

src/librustc/hir/def_id.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ impl serialize::UseSpecializedDecodable for CrateNum {}
8181
/// Since the DefIndex is mostly treated as an opaque ID, you probably
8282
/// don't have to care about these address spaces.
8383
84-
#[derive(Clone, Eq, Ord, PartialOrd, PartialEq, Hash, Copy)]
84+
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Copy)]
8585
pub struct DefIndex(u32);
8686

8787
/// The crate root is always assigned index 0 by the AST Map code,
@@ -150,7 +150,7 @@ impl DefIndex {
150150
impl serialize::UseSpecializedEncodable for DefIndex {}
151151
impl serialize::UseSpecializedDecodable for DefIndex {}
152152

153-
#[derive(Copy, Clone, Eq, PartialEq, Hash)]
153+
#[derive(Copy, Clone, Hash)]
154154
pub enum DefIndexAddressSpace {
155155
Low = 0,
156156
High = 1,
@@ -165,7 +165,7 @@ impl DefIndexAddressSpace {
165165

166166
/// A DefId identifies a particular *definition*, by combining a crate
167167
/// index and a def index.
168-
#[derive(Clone, Eq, Ord, PartialOrd, PartialEq, Hash, Copy)]
168+
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Copy)]
169169
pub struct DefId {
170170
pub krate: CrateNum,
171171
pub index: DefIndex,
@@ -216,7 +216,7 @@ impl serialize::UseSpecializedDecodable for DefId {}
216216
/// few cases where we know that only DefIds from the local crate are expected
217217
/// and a DefId from a different crate would signify a bug somewhere. This
218218
/// is when LocalDefId comes in handy.
219-
#[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Hash)]
219+
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
220220
pub struct LocalDefId(DefIndex);
221221

222222
impl LocalDefId {

src/librustc/hir/intravisit.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ use super::itemlikevisit::DeepVisitor;
5151
use std::cmp;
5252
use std::u32;
5353

54-
#[derive(Copy, Clone, PartialEq, Eq)]
54+
#[derive(Copy, Clone)]
5555
pub enum FnKind<'a> {
5656
/// #[xxx] pub async/const/extern "Abi" fn foo()
5757
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) {
11151115
// would be to walk it.
11161116
}
11171117

1118-
#[derive(Copy, Clone, RustcEncodable, RustcDecodable, Debug, PartialEq, Eq)]
1118+
#[derive(Copy, Clone, RustcEncodable, RustcDecodable, Debug)]
11191119
pub struct IdRange {
11201120
pub min: NodeId,
11211121
pub max: NodeId,

src/librustc/hir/lowering.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ pub fn lower_crate(
238238
}.lower_crate(krate)
239239
}
240240

241-
#[derive(Copy, Clone, PartialEq, Eq)]
241+
#[derive(Copy, Clone, PartialEq)]
242242
enum ParamMode {
243243
/// Any path in a type context.
244244
Explicit,
@@ -1927,7 +1927,7 @@ impl<'a> LoweringContext<'a> {
19271927
variadic: decl.variadic,
19281928
has_implicit_self: decl.inputs.get(0).map_or(false, |arg| match arg.ty.node {
19291929
TyKind::ImplicitSelf => true,
1930-
TyKind::Rptr(_, ref mt) => mt.ty.node == TyKind::ImplicitSelf,
1930+
TyKind::Rptr(_, ref mt) => mt.ty.node.is_implicit_self(),
19311931
_ => false,
19321932
}),
19331933
})

src/librustc/hir/map/definitions.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ pub struct Definitions {
171171
/// A unique identifier that we can use to lookup a definition
172172
/// precisely. It combines the index of the definition's parent (if
173173
/// any) with a `DisambiguatedDefPathData`.
174-
#[derive(Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)]
174+
#[derive(Clone, PartialEq, Debug, Hash, RustcEncodable, RustcDecodable)]
175175
pub struct DefKey {
176176
/// Parent path.
177177
pub parent: Option<DefIndex>,
@@ -223,13 +223,13 @@ impl DefKey {
223223
/// between them. This introduces some artificial ordering dependency
224224
/// but means that if you have (e.g.) two impls for the same type in
225225
/// the same module, they do get distinct def-ids.
226-
#[derive(Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)]
226+
#[derive(Clone, PartialEq, Debug, Hash, RustcEncodable, RustcDecodable)]
227227
pub struct DisambiguatedDefPathData {
228228
pub data: DefPathData,
229229
pub disambiguator: u32
230230
}
231231

232-
#[derive(Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)]
232+
#[derive(Clone, Debug, Hash, RustcEncodable, RustcDecodable)]
233233
pub struct DefPath {
234234
/// the path leading from the crate root to the item
235235
pub data: Vec<DisambiguatedDefPathData>,
@@ -311,7 +311,7 @@ impl DefPath {
311311
}
312312
}
313313

314-
#[derive(Clone, Debug, Eq, PartialEq, Hash, RustcEncodable, RustcDecodable)]
314+
#[derive(Clone, Debug, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable)]
315315
pub enum DefPathData {
316316
// Root: these should only be used for the root nodes, because
317317
// they are treated specially by the `def_path` function.
@@ -668,8 +668,7 @@ macro_rules! define_global_metadata_kind {
668668
(pub enum GlobalMetaDataKind {
669669
$($variant:ident),*
670670
}) => (
671-
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash,
672-
RustcEncodable, RustcDecodable)]
671+
#[derive(Clone, Copy, Debug, Hash, RustcEncodable, RustcDecodable)]
673672
pub enum GlobalMetaDataKind {
674673
$($variant),*
675674
}

0 commit comments

Comments
 (0)