Skip to content

Commit 781866f

Browse files
committed
More HashStable.
1 parent c4bc3f0 commit 781866f

File tree

13 files changed

+15
-94
lines changed

13 files changed

+15
-94
lines changed

src/librustc/dep_graph/dep_node.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ impl<'tcx> DepNodeParams<'tcx> for HirId {
578578
/// the need to be mapped or unmapped. (This ensures we can serialize
579579
/// them even in the absence of a tcx.)
580580
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash,
581-
RustcEncodable, RustcDecodable)]
581+
RustcEncodable, RustcDecodable, HashStable)]
582582
pub struct WorkProductId {
583583
hash: Fingerprint
584584
}
@@ -599,7 +599,3 @@ impl WorkProductId {
599599
}
600600
}
601601
}
602-
603-
impl_stable_hash_for!(struct crate::dep_graph::WorkProductId {
604-
hash
605-
});

src/librustc/mir/mono.rs

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ pub struct CodegenUnit<'tcx> {
251251
size_estimate: Option<usize>,
252252
}
253253

254-
#[derive(Copy, Clone, PartialEq, Debug, RustcEncodable, RustcDecodable)]
254+
#[derive(Copy, Clone, PartialEq, Debug, RustcEncodable, RustcDecodable, HashStable)]
255255
pub enum Linkage {
256256
External,
257257
AvailableExternally,
@@ -266,33 +266,13 @@ pub enum Linkage {
266266
Common,
267267
}
268268

269-
impl_stable_hash_for!(enum self::Linkage {
270-
External,
271-
AvailableExternally,
272-
LinkOnceAny,
273-
LinkOnceODR,
274-
WeakAny,
275-
WeakODR,
276-
Appending,
277-
Internal,
278-
Private,
279-
ExternalWeak,
280-
Common
281-
});
282-
283-
#[derive(Copy, Clone, PartialEq, Debug)]
269+
#[derive(Copy, Clone, PartialEq, Debug, HashStable)]
284270
pub enum Visibility {
285271
Default,
286272
Hidden,
287273
Protected,
288274
}
289275

290-
impl_stable_hash_for!(enum self::Visibility {
291-
Default,
292-
Hidden,
293-
Protected
294-
});
295-
296276
impl<'tcx> CodegenUnit<'tcx> {
297277
pub fn new(name: Symbol) -> CodegenUnit<'tcx> {
298278
CodegenUnit {

src/librustc/traits/query/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub type CanonicalTypeOpProvePredicateGoal<'tcx> =
4040
pub type CanonicalTypeOpNormalizeGoal<'tcx, T> =
4141
Canonical<'tcx, ty::ParamEnvAnd<'tcx, type_op::normalize::Normalize<T>>>;
4242

43-
#[derive(Clone, Debug)]
43+
#[derive(Clone, Debug, HashStable)]
4444
pub struct NoSolution;
4545

4646
pub type Fallible<T> = Result<T, NoSolution>;
@@ -50,5 +50,3 @@ impl<'tcx> From<TypeError<'tcx>> for NoSolution {
5050
NoSolution
5151
}
5252
}
53-
54-
impl_stable_hash_for!(struct NoSolution { });

src/librustc/traits/query/type_op/ascribe_user_type.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::hir::def_id::DefId;
44
use crate::ty::{ParamEnvAnd, Ty, TyCtxt};
55
use crate::ty::subst::UserSubsts;
66

7-
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, TypeFoldable, Lift)]
7+
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, HashStable, TypeFoldable, Lift)]
88
pub struct AscribeUserType<'tcx> {
99
pub mir_ty: Ty<'tcx>,
1010
pub def_id: DefId,
@@ -38,9 +38,3 @@ impl<'tcx> super::QueryTypeOp<'tcx> for AscribeUserType<'tcx> {
3838
tcx.type_op_ascribe_user_type(canonicalized)
3939
}
4040
}
41-
42-
impl_stable_hash_for! {
43-
struct AscribeUserType<'tcx> {
44-
mir_ty, def_id, user_substs
45-
}
46-
}

src/librustc/traits/query/type_op/eq.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::infer::canonical::{Canonicalized, CanonicalizedQueryResponse};
22
use crate::traits::query::Fallible;
33
use crate::ty::{ParamEnvAnd, Ty, TyCtxt};
44

5-
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, TypeFoldable, Lift)]
5+
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, HashStable, TypeFoldable, Lift)]
66
pub struct Eq<'tcx> {
77
pub a: Ty<'tcx>,
88
pub b: Ty<'tcx>,
@@ -35,7 +35,3 @@ impl<'tcx> super::QueryTypeOp<'tcx> for Eq<'tcx> {
3535
tcx.type_op_eq(canonicalized)
3636
}
3737
}
38-
39-
impl_stable_hash_for! {
40-
struct Eq<'tcx> { a, b }
41-
}

src/librustc/traits/query/type_op/implied_outlives_bounds.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::traits::query::outlives_bounds::OutlivesBound;
33
use crate::traits::query::Fallible;
44
use crate::ty::{ParamEnvAnd, Ty, TyCtxt};
55

6-
#[derive(Clone, Debug, TypeFoldable, Lift)]
6+
#[derive(Clone, Debug, HashStable, TypeFoldable, Lift)]
77
pub struct ImpliedOutlivesBounds<'tcx> {
88
pub ty: Ty<'tcx>,
99
}
@@ -39,7 +39,3 @@ impl<'tcx> super::QueryTypeOp<'tcx> for ImpliedOutlivesBounds<'tcx> {
3939
tcx.implied_outlives_bounds(canonicalized)
4040
}
4141
}
42-
43-
impl_stable_hash_for! {
44-
struct ImpliedOutlivesBounds<'tcx> { ty }
45-
}

src/librustc/traits/query/type_op/normalize.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::traits::query::Fallible;
44
use crate::ty::fold::TypeFoldable;
55
use crate::ty::{self, Lift, ParamEnvAnd, Ty, TyCtxt};
66

7-
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, TypeFoldable, Lift)]
7+
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, HashStable, TypeFoldable, Lift)]
88
pub struct Normalize<T> {
99
pub value: T,
1010
}
@@ -82,9 +82,3 @@ impl Normalizable<'tcx> for ty::FnSig<'tcx> {
8282
tcx.type_op_normalize_fn_sig(canonicalized)
8383
}
8484
}
85-
86-
impl_stable_hash_for! {
87-
impl<T> for struct Normalize<T> {
88-
value
89-
}
90-
}

src/librustc/traits/query/type_op/outlives.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::traits::query::dropck_outlives::{DropckOutlivesResult, trivial_dropck
33
use crate::traits::query::Fallible;
44
use crate::ty::{ParamEnvAnd, Ty, TyCtxt};
55

6-
#[derive(Copy, Clone, Debug, TypeFoldable, Lift)]
6+
#[derive(Copy, Clone, Debug, HashStable, TypeFoldable, Lift)]
77
pub struct DropckOutlives<'tcx> {
88
dropped_ty: Ty<'tcx>,
99
}
@@ -53,7 +53,3 @@ impl super::QueryTypeOp<'tcx> for DropckOutlives<'tcx> {
5353
tcx.dropck_outlives(canonicalized)
5454
}
5555
}
56-
57-
impl_stable_hash_for! {
58-
struct DropckOutlives<'tcx> { dropped_ty }
59-
}

src/librustc/traits/query/type_op/prove_predicate.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::infer::canonical::{Canonicalized, CanonicalizedQueryResponse};
22
use crate::traits::query::Fallible;
33
use crate::ty::{ParamEnvAnd, Predicate, TyCtxt};
44

5-
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, TypeFoldable, Lift)]
5+
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, HashStable, TypeFoldable, Lift)]
66
pub struct ProvePredicate<'tcx> {
77
pub predicate: Predicate<'tcx>,
88
}
@@ -44,7 +44,3 @@ impl<'tcx> super::QueryTypeOp<'tcx> for ProvePredicate<'tcx> {
4444
tcx.type_op_prove_predicate(canonicalized)
4545
}
4646
}
47-
48-
impl_stable_hash_for! {
49-
struct ProvePredicate<'tcx> { predicate }
50-
}

src/librustc/traits/query/type_op/subtype.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::infer::canonical::{Canonicalized, CanonicalizedQueryResponse};
22
use crate::traits::query::Fallible;
33
use crate::ty::{ParamEnvAnd, Ty, TyCtxt};
44

5-
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, TypeFoldable, Lift)]
5+
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, HashStable, TypeFoldable, Lift)]
66
pub struct Subtype<'tcx> {
77
pub sub: Ty<'tcx>,
88
pub sup: Ty<'tcx>,
@@ -35,7 +35,3 @@ impl<'tcx> super::QueryTypeOp<'tcx> for Subtype<'tcx> {
3535
tcx.type_op_subtype(canonicalized)
3636
}
3737
}
38-
39-
impl_stable_hash_for! {
40-
struct Subtype<'tcx> { sub, sup }
41-
}

src/librustc/traits/select.rs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,6 @@ enum BuiltinImplConditions<'tcx> {
367367
Ambiguous,
368368
}
369369

370-
#[derive(Copy, Clone, Debug, PartialOrd, Ord, PartialEq, Eq)]
371370
/// The result of trait evaluation. The order is important
372371
/// here as the evaluation of a list is the maximum of the
373372
/// evaluations.
@@ -380,6 +379,7 @@ enum BuiltinImplConditions<'tcx> {
380379
/// all the "potential success" candidates can potentially succeed,
381380
/// so they are noops when unioned with a definite error, and within
382381
/// the categories it's easy to see that the unions are correct.
382+
#[derive(Copy, Clone, Debug, PartialOrd, Ord, PartialEq, Eq, HashStable)]
383383
pub enum EvaluationResult {
384384
/// Evaluation successful
385385
EvaluatedToOk,
@@ -478,21 +478,10 @@ impl EvaluationResult {
478478
}
479479
}
480480

481-
impl_stable_hash_for!(enum self::EvaluationResult {
482-
EvaluatedToOk,
483-
EvaluatedToOkModuloRegions,
484-
EvaluatedToAmbig,
485-
EvaluatedToUnknown,
486-
EvaluatedToRecur,
487-
EvaluatedToErr
488-
});
489-
490-
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
491481
/// Indicates that trait evaluation caused overflow.
482+
#[derive(Copy, Clone, Debug, PartialEq, Eq, HashStable)]
492483
pub struct OverflowError;
493484

494-
impl_stable_hash_for!(struct OverflowError {});
495-
496485
impl<'tcx> From<OverflowError> for SelectionError<'tcx> {
497486
fn from(OverflowError: OverflowError) -> SelectionError<'tcx> {
498487
SelectionError::Overflow

src/librustc/traits/specialize/specialization_graph.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use crate::util::nodemap::{DefIdMap, FxHashMap};
2424
/// parents of a given specializing impl, which is needed for extracting
2525
/// default items amongst other things. In the simple "chain" rule, every impl
2626
/// has at most one parent.
27-
#[derive(RustcEncodable, RustcDecodable)]
27+
#[derive(RustcEncodable, RustcDecodable, HashStable)]
2828
pub struct Graph {
2929
// All impls have a parent; the "root" impls have as their parent the `def_id`
3030
// of the trait.
@@ -535,8 +535,3 @@ impl<'a> HashStable<StableHashingContext<'a>> for Children {
535535
ich::hash_stable_trait_impls(hcx, hasher, blanket_impls, nonblanket_impls);
536536
}
537537
}
538-
539-
impl_stable_hash_for!(struct self::Graph {
540-
parent,
541-
children
542-
});

src/librustc/ty/binding.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::hir::BindingAnnotation::*;
22
use crate::hir::BindingAnnotation;
33
use crate::hir::Mutability;
44

5-
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy)]
5+
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy, HashStable)]
66
pub enum BindingMode {
77
BindByReference(Mutability),
88
BindByValue(Mutability),
@@ -20,8 +20,3 @@ impl BindingMode {
2020
}
2121
}
2222
}
23-
24-
impl_stable_hash_for!(enum self::BindingMode {
25-
BindByReference(mutability),
26-
BindByValue(mutability)
27-
});

0 commit comments

Comments
 (0)