@@ -2,7 +2,6 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
2
2
use rustc_serialize:: Decoder ;
3
3
use rustc_serialize:: { Decodable , Encodable } ;
4
4
use std:: fmt;
5
- use std:: hash;
6
5
use std:: ops:: ControlFlow ;
7
6
8
7
use crate :: fold:: { FallibleTypeFolder , TypeFoldable } ;
@@ -13,7 +12,7 @@ use crate::{TyDecoder, TyEncoder};
13
12
/// A clause is something that can appear in where bounds or be inferred
14
13
/// by implied bounds.
15
14
#[ derive( derivative:: Derivative ) ]
16
- #[ derivative( Clone ( bound = "" ) ) ]
15
+ #[ derivative( Clone ( bound = "" ) , Hash ( bound = "" ) ) ]
17
16
pub enum ClauseKind < I : Interner > {
18
17
/// Corresponds to `where Foo: Bar<A, B, C>`. `Foo` here would be
19
18
/// 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 {
82
81
}
83
82
}
84
83
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
-
103
84
impl < CTX : HashStableContext , I : Interner > HashStable < CTX > for ClauseKind < I >
104
85
where
105
86
I :: Ty : HashStable < CTX > ,
@@ -238,7 +219,7 @@ where
238
219
}
239
220
240
221
#[ derive( derivative:: Derivative ) ]
241
- #[ derivative( Clone ( bound = "" ) ) ]
222
+ #[ derivative( Clone ( bound = "" ) , Hash ( bound = "" ) ) ]
242
223
pub enum PredicateKind < I : Interner > {
243
224
/// Prove a clause
244
225
Clause ( ClauseKind < I > ) ,
@@ -329,33 +310,6 @@ fn predicate_kind_discriminant<I: Interner>(value: &PredicateKind<I>) -> usize {
329
310
}
330
311
}
331
312
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
-
359
313
impl < CTX : HashStableContext , I : Interner > HashStable < CTX > for PredicateKind < I >
360
314
where
361
315
I :: DefId : HashStable < CTX > ,
0 commit comments