@@ -2,10 +2,11 @@ use crate::consts::{constant_context, constant_simple};
2
2
use crate :: utils:: differing_macro_contexts;
3
3
use rustc:: hir:: ptr:: P ;
4
4
use rustc:: hir:: * ;
5
+ use rustc:: ich:: StableHashingContextProvider ;
5
6
use rustc:: lint:: LateContext ;
6
7
use rustc:: ty:: TypeckTables ;
7
- use std :: collections :: hash_map :: DefaultHasher ;
8
- use std:: hash:: { Hash , Hasher } ;
8
+ use rustc_data_structures :: stable_hasher :: { HashStable , StableHasher } ;
9
+ use std:: hash:: Hash ;
9
10
use syntax:: ast:: Name ;
10
11
11
12
/// Type used to check whether two ast are the same. This is different from the
@@ -348,15 +349,15 @@ pub struct SpanlessHash<'a, 'tcx> {
348
349
/// Context used to evaluate constant expressions.
349
350
cx : & ' a LateContext < ' a , ' tcx > ,
350
351
tables : & ' a TypeckTables < ' tcx > ,
351
- s : DefaultHasher ,
352
+ s : StableHasher ,
352
353
}
353
354
354
355
impl < ' a , ' tcx > SpanlessHash < ' a , ' tcx > {
355
356
pub fn new ( cx : & ' a LateContext < ' a , ' tcx > , tables : & ' a TypeckTables < ' tcx > ) -> Self {
356
357
Self {
357
358
cx,
358
359
tables,
359
- s : DefaultHasher :: new ( ) ,
360
+ s : StableHasher :: new ( ) ,
360
361
}
361
362
}
362
363
@@ -411,15 +412,15 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
411
412
self . hash_expr ( r) ;
412
413
} ,
413
414
ExprKind :: AssignOp ( ref o, ref l, ref r) => {
414
- o. node . hash ( & mut self . s ) ;
415
+ o. node . hash_stable ( & mut self . cx . tcx . get_stable_hashing_context ( ) , & mut self . s ) ;
415
416
self . hash_expr ( l) ;
416
417
self . hash_expr ( r) ;
417
418
} ,
418
419
ExprKind :: Block ( ref b, _) => {
419
420
self . hash_block ( b) ;
420
421
} ,
421
422
ExprKind :: Binary ( op, ref l, ref r) => {
422
- op. node . hash ( & mut self . s ) ;
423
+ op. node . hash_stable ( & mut self . cx . tcx . get_stable_hashing_context ( ) , & mut self . s ) ;
423
424
self . hash_expr ( l) ;
424
425
self . hash_expr ( r) ;
425
426
} ,
@@ -519,7 +520,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
519
520
self . hash_exprs ( v) ;
520
521
} ,
521
522
ExprKind :: Unary ( lop, ref le) => {
522
- lop. hash ( & mut self . s ) ;
523
+ lop. hash_stable ( & mut self . cx . tcx . get_stable_hashing_context ( ) , & mut self . s ) ;
523
524
self . hash_expr ( le) ;
524
525
} ,
525
526
}
0 commit comments