More HashStable.

This commit is contained in:
Camille GILLOT 2019-11-09 23:28:07 +01:00
parent c4bc3f05f5
commit 781866f3a9
13 changed files with 15 additions and 94 deletions

View File

@ -578,7 +578,7 @@ impl<'tcx> DepNodeParams<'tcx> for HirId {
/// the need to be mapped or unmapped. (This ensures we can serialize
/// them even in the absence of a tcx.)
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash,
RustcEncodable, RustcDecodable)]
RustcEncodable, RustcDecodable, HashStable)]
pub struct WorkProductId {
hash: Fingerprint
}
@ -599,7 +599,3 @@ impl WorkProductId {
}
}
}
impl_stable_hash_for!(struct crate::dep_graph::WorkProductId {
hash
});

View File

@ -251,7 +251,7 @@ pub struct CodegenUnit<'tcx> {
size_estimate: Option<usize>,
}
#[derive(Copy, Clone, PartialEq, Debug, RustcEncodable, RustcDecodable)]
#[derive(Copy, Clone, PartialEq, Debug, RustcEncodable, RustcDecodable, HashStable)]
pub enum Linkage {
External,
AvailableExternally,
@ -266,33 +266,13 @@ pub enum Linkage {
Common,
}
impl_stable_hash_for!(enum self::Linkage {
External,
AvailableExternally,
LinkOnceAny,
LinkOnceODR,
WeakAny,
WeakODR,
Appending,
Internal,
Private,
ExternalWeak,
Common
});
#[derive(Copy, Clone, PartialEq, Debug)]
#[derive(Copy, Clone, PartialEq, Debug, HashStable)]
pub enum Visibility {
Default,
Hidden,
Protected,
}
impl_stable_hash_for!(enum self::Visibility {
Default,
Hidden,
Protected
});
impl<'tcx> CodegenUnit<'tcx> {
pub fn new(name: Symbol) -> CodegenUnit<'tcx> {
CodegenUnit {

View File

@ -40,7 +40,7 @@ pub type CanonicalTypeOpProvePredicateGoal<'tcx> =
pub type CanonicalTypeOpNormalizeGoal<'tcx, T> =
Canonical<'tcx, ty::ParamEnvAnd<'tcx, type_op::normalize::Normalize<T>>>;
#[derive(Clone, Debug)]
#[derive(Clone, Debug, HashStable)]
pub struct NoSolution;
pub type Fallible<T> = Result<T, NoSolution>;
@ -50,5 +50,3 @@ impl<'tcx> From<TypeError<'tcx>> for NoSolution {
NoSolution
}
}
impl_stable_hash_for!(struct NoSolution { });

View File

@ -4,7 +4,7 @@ use crate::hir::def_id::DefId;
use crate::ty::{ParamEnvAnd, Ty, TyCtxt};
use crate::ty::subst::UserSubsts;
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, TypeFoldable, Lift)]
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, HashStable, TypeFoldable, Lift)]
pub struct AscribeUserType<'tcx> {
pub mir_ty: Ty<'tcx>,
pub def_id: DefId,
@ -38,9 +38,3 @@ impl<'tcx> super::QueryTypeOp<'tcx> for AscribeUserType<'tcx> {
tcx.type_op_ascribe_user_type(canonicalized)
}
}
impl_stable_hash_for! {
struct AscribeUserType<'tcx> {
mir_ty, def_id, user_substs
}
}

View File

@ -2,7 +2,7 @@ use crate::infer::canonical::{Canonicalized, CanonicalizedQueryResponse};
use crate::traits::query::Fallible;
use crate::ty::{ParamEnvAnd, Ty, TyCtxt};
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, TypeFoldable, Lift)]
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, HashStable, TypeFoldable, Lift)]
pub struct Eq<'tcx> {
pub a: Ty<'tcx>,
pub b: Ty<'tcx>,
@ -35,7 +35,3 @@ impl<'tcx> super::QueryTypeOp<'tcx> for Eq<'tcx> {
tcx.type_op_eq(canonicalized)
}
}
impl_stable_hash_for! {
struct Eq<'tcx> { a, b }
}

View File

@ -3,7 +3,7 @@ use crate::traits::query::outlives_bounds::OutlivesBound;
use crate::traits::query::Fallible;
use crate::ty::{ParamEnvAnd, Ty, TyCtxt};
#[derive(Clone, Debug, TypeFoldable, Lift)]
#[derive(Clone, Debug, HashStable, TypeFoldable, Lift)]
pub struct ImpliedOutlivesBounds<'tcx> {
pub ty: Ty<'tcx>,
}
@ -39,7 +39,3 @@ impl<'tcx> super::QueryTypeOp<'tcx> for ImpliedOutlivesBounds<'tcx> {
tcx.implied_outlives_bounds(canonicalized)
}
}
impl_stable_hash_for! {
struct ImpliedOutlivesBounds<'tcx> { ty }
}

View File

@ -4,7 +4,7 @@ use crate::traits::query::Fallible;
use crate::ty::fold::TypeFoldable;
use crate::ty::{self, Lift, ParamEnvAnd, Ty, TyCtxt};
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, TypeFoldable, Lift)]
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, HashStable, TypeFoldable, Lift)]
pub struct Normalize<T> {
pub value: T,
}
@ -82,9 +82,3 @@ impl Normalizable<'tcx> for ty::FnSig<'tcx> {
tcx.type_op_normalize_fn_sig(canonicalized)
}
}
impl_stable_hash_for! {
impl<T> for struct Normalize<T> {
value
}
}

View File

@ -3,7 +3,7 @@ use crate::traits::query::dropck_outlives::{DropckOutlivesResult, trivial_dropck
use crate::traits::query::Fallible;
use crate::ty::{ParamEnvAnd, Ty, TyCtxt};
#[derive(Copy, Clone, Debug, TypeFoldable, Lift)]
#[derive(Copy, Clone, Debug, HashStable, TypeFoldable, Lift)]
pub struct DropckOutlives<'tcx> {
dropped_ty: Ty<'tcx>,
}
@ -53,7 +53,3 @@ impl super::QueryTypeOp<'tcx> for DropckOutlives<'tcx> {
tcx.dropck_outlives(canonicalized)
}
}
impl_stable_hash_for! {
struct DropckOutlives<'tcx> { dropped_ty }
}

View File

@ -2,7 +2,7 @@ use crate::infer::canonical::{Canonicalized, CanonicalizedQueryResponse};
use crate::traits::query::Fallible;
use crate::ty::{ParamEnvAnd, Predicate, TyCtxt};
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, TypeFoldable, Lift)]
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, HashStable, TypeFoldable, Lift)]
pub struct ProvePredicate<'tcx> {
pub predicate: Predicate<'tcx>,
}
@ -44,7 +44,3 @@ impl<'tcx> super::QueryTypeOp<'tcx> for ProvePredicate<'tcx> {
tcx.type_op_prove_predicate(canonicalized)
}
}
impl_stable_hash_for! {
struct ProvePredicate<'tcx> { predicate }
}

View File

@ -2,7 +2,7 @@ use crate::infer::canonical::{Canonicalized, CanonicalizedQueryResponse};
use crate::traits::query::Fallible;
use crate::ty::{ParamEnvAnd, Ty, TyCtxt};
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, TypeFoldable, Lift)]
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, HashStable, TypeFoldable, Lift)]
pub struct Subtype<'tcx> {
pub sub: Ty<'tcx>,
pub sup: Ty<'tcx>,
@ -35,7 +35,3 @@ impl<'tcx> super::QueryTypeOp<'tcx> for Subtype<'tcx> {
tcx.type_op_subtype(canonicalized)
}
}
impl_stable_hash_for! {
struct Subtype<'tcx> { sub, sup }
}

View File

@ -367,7 +367,6 @@ enum BuiltinImplConditions<'tcx> {
Ambiguous,
}
#[derive(Copy, Clone, Debug, PartialOrd, Ord, PartialEq, Eq)]
/// The result of trait evaluation. The order is important
/// here as the evaluation of a list is the maximum of the
/// evaluations.
@ -380,6 +379,7 @@ enum BuiltinImplConditions<'tcx> {
/// all the "potential success" candidates can potentially succeed,
/// so they are noops when unioned with a definite error, and within
/// the categories it's easy to see that the unions are correct.
#[derive(Copy, Clone, Debug, PartialOrd, Ord, PartialEq, Eq, HashStable)]
pub enum EvaluationResult {
/// Evaluation successful
EvaluatedToOk,
@ -478,21 +478,10 @@ impl EvaluationResult {
}
}
impl_stable_hash_for!(enum self::EvaluationResult {
EvaluatedToOk,
EvaluatedToOkModuloRegions,
EvaluatedToAmbig,
EvaluatedToUnknown,
EvaluatedToRecur,
EvaluatedToErr
});
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
/// Indicates that trait evaluation caused overflow.
#[derive(Copy, Clone, Debug, PartialEq, Eq, HashStable)]
pub struct OverflowError;
impl_stable_hash_for!(struct OverflowError {});
impl<'tcx> From<OverflowError> for SelectionError<'tcx> {
fn from(OverflowError: OverflowError) -> SelectionError<'tcx> {
SelectionError::Overflow

View File

@ -24,7 +24,7 @@ use crate::util::nodemap::{DefIdMap, FxHashMap};
/// parents of a given specializing impl, which is needed for extracting
/// default items amongst other things. In the simple "chain" rule, every impl
/// has at most one parent.
#[derive(RustcEncodable, RustcDecodable)]
#[derive(RustcEncodable, RustcDecodable, HashStable)]
pub struct Graph {
// All impls have a parent; the "root" impls have as their parent the `def_id`
// of the trait.
@ -535,8 +535,3 @@ impl<'a> HashStable<StableHashingContext<'a>> for Children {
ich::hash_stable_trait_impls(hcx, hasher, blanket_impls, nonblanket_impls);
}
}
impl_stable_hash_for!(struct self::Graph {
parent,
children
});

View File

@ -2,7 +2,7 @@ use crate::hir::BindingAnnotation::*;
use crate::hir::BindingAnnotation;
use crate::hir::Mutability;
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy)]
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy, HashStable)]
pub enum BindingMode {
BindByReference(Mutability),
BindByValue(Mutability),
@ -20,8 +20,3 @@ impl BindingMode {
}
}
}
impl_stable_hash_for!(enum self::BindingMode {
BindByReference(mutability),
BindByValue(mutability)
});