@@ -2,7 +2,6 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
22use rustc_serialize:: Decoder ;
33use rustc_serialize:: { Decodable , Encodable } ;
44use std:: fmt;
5- use std:: hash;
65use std:: ops:: ControlFlow ;
76
87use crate :: fold:: { FallibleTypeFolder , TypeFoldable } ;
@@ -13,7 +12,7 @@ use crate::{TyDecoder, TyEncoder};
1312/// A clause is something that can appear in where bounds or be inferred
1413/// by implied bounds.
1514#[ derive( derivative:: Derivative ) ]
16- #[ derivative( Clone ( bound = "" ) ) ]
15+ #[ derivative( Clone ( bound = "" ) , Hash ( bound = "" ) ) ]
1716pub enum ClauseKind < I : Interner > {
1817 /// Corresponds to `where Foo: Bar<A, B, C>`. `Foo` here would be
1918 /// the `Self` type of the trait reference and `A`, `B`, and `C`
@@ -82,24 +81,6 @@ fn clause_kind_discriminant<I: Interner>(value: &ClauseKind<I>) -> usize {
8281 }
8382}
8483
85- impl < I : Interner > hash:: Hash for ClauseKind < I > {
86- fn hash < H : hash:: Hasher > ( & self , state : & mut H ) {
87- clause_kind_discriminant ( self ) . hash ( state) ;
88- match self {
89- ClauseKind :: Trait ( p) => p. hash ( state) ,
90- ClauseKind :: RegionOutlives ( p) => p. hash ( state) ,
91- ClauseKind :: TypeOutlives ( p) => p. hash ( state) ,
92- ClauseKind :: Projection ( p) => p. hash ( state) ,
93- ClauseKind :: ConstArgHasType ( c, t) => {
94- c. hash ( state) ;
95- t. hash ( state) ;
96- }
97- ClauseKind :: WellFormed ( t) => t. hash ( state) ,
98- ClauseKind :: ConstEvaluatable ( c) => c. hash ( state) ,
99- }
100- }
101- }
102-
10384impl < CTX : HashStableContext , I : Interner > HashStable < CTX > for ClauseKind < I >
10485where
10586 I :: Ty : HashStable < CTX > ,
@@ -238,7 +219,7 @@ where
238219}
239220
240221#[ derive( derivative:: Derivative ) ]
241- #[ derivative( Clone ( bound = "" ) ) ]
222+ #[ derivative( Clone ( bound = "" ) , Hash ( bound = "" ) ) ]
242223pub enum PredicateKind < I : Interner > {
243224 /// Prove a clause
244225 Clause ( ClauseKind < I > ) ,
@@ -329,33 +310,6 @@ fn predicate_kind_discriminant<I: Interner>(value: &PredicateKind<I>) -> usize {
329310 }
330311}
331312
332- impl < I : Interner > hash:: Hash for PredicateKind < I > {
333- fn hash < H : hash:: Hasher > ( & self , state : & mut H ) {
334- predicate_kind_discriminant ( self ) . hash ( state) ;
335- match self {
336- PredicateKind :: Clause ( p) => p. hash ( state) ,
337- PredicateKind :: ObjectSafe ( d) => d. hash ( state) ,
338- PredicateKind :: ClosureKind ( d, g, k) => {
339- d. hash ( state) ;
340- g. hash ( state) ;
341- k. hash ( state) ;
342- }
343- PredicateKind :: Subtype ( p) => p. hash ( state) ,
344- PredicateKind :: Coerce ( p) => p. hash ( state) ,
345- PredicateKind :: ConstEquate ( c1, c2) => {
346- c1. hash ( state) ;
347- c2. hash ( state) ;
348- }
349- PredicateKind :: Ambiguous => { }
350- PredicateKind :: AliasRelate ( t1, t2, r) => {
351- t1. hash ( state) ;
352- t2. hash ( state) ;
353- r. hash ( state) ;
354- }
355- }
356- }
357- }
358-
359313impl < CTX : HashStableContext , I : Interner > HashStable < CTX > for PredicateKind < I >
360314where
361315 I :: DefId : HashStable < CTX > ,
0 commit comments