Derive HashStable more.

This commit is contained in:
Camille GILLOT 2019-11-10 18:41:09 +01:00
parent 781866f3a9
commit e1522fa183
4 changed files with 6 additions and 29 deletions

View File

@ -1215,7 +1215,7 @@ impl UnOp {
}
/// A statement.
#[derive(RustcEncodable, RustcDecodable)]
#[derive(RustcEncodable, RustcDecodable, HashStable)]
pub struct Stmt {
pub hir_id: HirId,
pub kind: StmtKind,

View File

@ -140,13 +140,6 @@ impl<'a> HashStable<StableHashingContext<'a>> for hir::Ty {
impl_stable_hash_for_spanned!(hir::BinOpKind);
impl_stable_hash_for!(struct hir::Stmt {
hir_id,
kind,
span,
});
impl_stable_hash_for_spanned!(ast::Name);
impl<'a> HashStable<StableHashingContext<'a>> for hir::Expr {

View File

@ -1589,13 +1589,12 @@ rustc_index::newtype_index! {
/// declared, but a type name in a non-zero universe is a placeholder
/// type -- an idealized representative of "types in general" that we
/// use for checking generic functions.
#[derive(HashStable)]
pub struct UniverseIndex {
DEBUG_FORMAT = "U{}",
}
}
impl_stable_hash_for!(struct UniverseIndex { private });
impl UniverseIndex {
pub const ROOT: UniverseIndex = UniverseIndex::from_u32_const(0);
@ -1839,7 +1838,7 @@ bitflags! {
}
/// Definition of a variant -- a struct's fields or a enum variant.
#[derive(Debug)]
#[derive(Debug, HashStable)]
pub struct VariantDef {
/// `DefId` that identifies the variant itself.
/// If this variant belongs to a struct or union, then this is a copy of its `DefId`.
@ -1848,6 +1847,7 @@ pub struct VariantDef {
/// If this variant is a struct variant, then this is `None`.
pub ctor_def_id: Option<DefId>,
/// Variant or struct name.
#[stable_hasher(project = name)]
pub ident: Ident,
/// Discriminant of this variant.
pub discr: VariantDiscr,
@ -1927,17 +1927,6 @@ impl<'tcx> VariantDef {
}
}
impl_stable_hash_for!(struct VariantDef {
def_id,
ctor_def_id,
ident -> (ident.name),
discr,
fields,
ctor_kind,
flags,
recovered
});
#[derive(Copy, Clone, Debug, PartialEq, Eq, RustcEncodable, RustcDecodable, HashStable)]
pub enum VariantDiscr {
/// Explicit value for this variant, i.e., `X = 123`.
@ -2061,7 +2050,7 @@ impl Into<DataTypeKind> for AdtKind {
}
bitflags! {
#[derive(RustcEncodable, RustcDecodable, Default)]
#[derive(RustcEncodable, RustcDecodable, Default, HashStable)]
pub struct ReprFlags: u8 {
const IS_C = 1 << 0;
const IS_SIMD = 1 << 1;
@ -2076,10 +2065,6 @@ bitflags! {
}
}
impl_stable_hash_for!(struct ReprFlags {
bits
});
/// Represents the repr options provided by the user,
#[derive(Copy, Clone, Debug, Eq, PartialEq, RustcEncodable, RustcDecodable,
Default, HashStable)]

View File

@ -1204,6 +1204,7 @@ rustc_index::newtype_index! {
/// is the outer fn.
///
/// [dbi]: http://en.wikipedia.org/wiki/De_Bruijn_index
#[derive(HashStable)]
pub struct DebruijnIndex {
DEBUG_FORMAT = "DebruijnIndex({})",
const INNERMOST = 0,
@ -1517,8 +1518,6 @@ impl DebruijnIndex {
}
}
impl_stable_hash_for!(struct DebruijnIndex { private });
/// Region utilities
impl RegionKind {
/// Is this region named by the user?