@@ -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,17 @@ 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
416
+ . hash_stable ( & mut self . cx . tcx . get_stable_hashing_context ( ) , & mut self . s ) ;
415
417
self . hash_expr ( l) ;
416
418
self . hash_expr ( r) ;
417
419
} ,
418
420
ExprKind :: Block ( ref b, _) => {
419
421
self . hash_block ( b) ;
420
422
} ,
421
423
ExprKind :: Binary ( op, ref l, ref r) => {
422
- op. node . hash ( & mut self . s ) ;
424
+ op. node
425
+ . hash_stable ( & mut self . cx . tcx . get_stable_hashing_context ( ) , & mut self . s ) ;
423
426
self . hash_expr ( l) ;
424
427
self . hash_expr ( r) ;
425
428
} ,
@@ -519,7 +522,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
519
522
self . hash_exprs ( v) ;
520
523
} ,
521
524
ExprKind :: Unary ( lop, ref le) => {
522
- lop. hash ( & mut self . s ) ;
525
+ lop. hash_stable ( & mut self . cx . tcx . get_stable_hashing_context ( ) , & mut self . s ) ;
523
526
self . hash_expr ( le) ;
524
527
} ,
525
528
}
0 commit comments