Skip to content

Commit e1522fa

Browse files
committed
Derive HashStable more.
1 parent 781866f commit e1522fa

File tree

4 files changed

+6
-29
lines changed

4 files changed

+6
-29
lines changed

src/librustc/hir/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1215,7 +1215,7 @@ impl UnOp {
12151215
}
12161216

12171217
/// A statement.
1218-
#[derive(RustcEncodable, RustcDecodable)]
1218+
#[derive(RustcEncodable, RustcDecodable, HashStable)]
12191219
pub struct Stmt {
12201220
pub hir_id: HirId,
12211221
pub kind: StmtKind,

src/librustc/ich/impls_hir.rs

-7
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,6 @@ impl<'a> HashStable<StableHashingContext<'a>> for hir::Ty {
140140

141141
impl_stable_hash_for_spanned!(hir::BinOpKind);
142142

143-
impl_stable_hash_for!(struct hir::Stmt {
144-
hir_id,
145-
kind,
146-
span,
147-
});
148-
149-
150143
impl_stable_hash_for_spanned!(ast::Name);
151144

152145
impl<'a> HashStable<StableHashingContext<'a>> for hir::Expr {

src/librustc/ty/mod.rs

+4-19
Original file line numberDiff line numberDiff line change
@@ -1589,13 +1589,12 @@ rustc_index::newtype_index! {
15891589
/// declared, but a type name in a non-zero universe is a placeholder
15901590
/// type -- an idealized representative of "types in general" that we
15911591
/// use for checking generic functions.
1592+
#[derive(HashStable)]
15921593
pub struct UniverseIndex {
15931594
DEBUG_FORMAT = "U{}",
15941595
}
15951596
}
15961597

1597-
impl_stable_hash_for!(struct UniverseIndex { private });
1598-
15991598
impl UniverseIndex {
16001599
pub const ROOT: UniverseIndex = UniverseIndex::from_u32_const(0);
16011600

@@ -1839,7 +1838,7 @@ bitflags! {
18391838
}
18401839

18411840
/// Definition of a variant -- a struct's fields or a enum variant.
1842-
#[derive(Debug)]
1841+
#[derive(Debug, HashStable)]
18431842
pub struct VariantDef {
18441843
/// `DefId` that identifies the variant itself.
18451844
/// If this variant belongs to a struct or union, then this is a copy of its `DefId`.
@@ -1848,6 +1847,7 @@ pub struct VariantDef {
18481847
/// If this variant is a struct variant, then this is `None`.
18491848
pub ctor_def_id: Option<DefId>,
18501849
/// Variant or struct name.
1850+
#[stable_hasher(project = name)]
18511851
pub ident: Ident,
18521852
/// Discriminant of this variant.
18531853
pub discr: VariantDiscr,
@@ -1927,17 +1927,6 @@ impl<'tcx> VariantDef {
19271927
}
19281928
}
19291929

1930-
impl_stable_hash_for!(struct VariantDef {
1931-
def_id,
1932-
ctor_def_id,
1933-
ident -> (ident.name),
1934-
discr,
1935-
fields,
1936-
ctor_kind,
1937-
flags,
1938-
recovered
1939-
});
1940-
19411930
#[derive(Copy, Clone, Debug, PartialEq, Eq, RustcEncodable, RustcDecodable, HashStable)]
19421931
pub enum VariantDiscr {
19431932
/// Explicit value for this variant, i.e., `X = 123`.
@@ -2061,7 +2050,7 @@ impl Into<DataTypeKind> for AdtKind {
20612050
}
20622051

20632052
bitflags! {
2064-
#[derive(RustcEncodable, RustcDecodable, Default)]
2053+
#[derive(RustcEncodable, RustcDecodable, Default, HashStable)]
20652054
pub struct ReprFlags: u8 {
20662055
const IS_C = 1 << 0;
20672056
const IS_SIMD = 1 << 1;
@@ -2076,10 +2065,6 @@ bitflags! {
20762065
}
20772066
}
20782067

2079-
impl_stable_hash_for!(struct ReprFlags {
2080-
bits
2081-
});
2082-
20832068
/// Represents the repr options provided by the user,
20842069
#[derive(Copy, Clone, Debug, Eq, PartialEq, RustcEncodable, RustcDecodable,
20852070
Default, HashStable)]

src/librustc/ty/sty.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1204,6 +1204,7 @@ rustc_index::newtype_index! {
12041204
/// is the outer fn.
12051205
///
12061206
/// [dbi]: http://en.wikipedia.org/wiki/De_Bruijn_index
1207+
#[derive(HashStable)]
12071208
pub struct DebruijnIndex {
12081209
DEBUG_FORMAT = "DebruijnIndex({})",
12091210
const INNERMOST = 0,
@@ -1517,8 +1518,6 @@ impl DebruijnIndex {
15171518
}
15181519
}
15191520

1520-
impl_stable_hash_for!(struct DebruijnIndex { private });
1521-
15221521
/// Region utilities
15231522
impl RegionKind {
15241523
/// Is this region named by the user?

0 commit comments

Comments
 (0)