Skip to content

Commit 9a2e500

Browse files
committed
Auto merge of #4715 - rust-lang:rustup, r=phansch
Rustup to rust-lang/rust#65647 cc rust-lang/rust#65647 waiting on rust-lang/rust#65690 changelog: none
2 parents 1d0f625 + e8d5a9e commit 9a2e500

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

clippy_lints/src/utils/hir_utils.rs

+12-9
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ use crate::consts::{constant_context, constant_simple};
22
use crate::utils::differing_macro_contexts;
33
use rustc::hir::ptr::P;
44
use rustc::hir::*;
5+
use rustc::ich::StableHashingContextProvider;
56
use rustc::lint::LateContext;
67
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;
910
use syntax::ast::Name;
1011

1112
/// Type used to check whether two ast are the same. This is different from the
@@ -348,19 +349,19 @@ pub struct SpanlessHash<'a, 'tcx> {
348349
/// Context used to evaluate constant expressions.
349350
cx: &'a LateContext<'a, 'tcx>,
350351
tables: &'a TypeckTables<'tcx>,
351-
s: DefaultHasher,
352+
s: StableHasher,
352353
}
353354

354355
impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
355356
pub fn new(cx: &'a LateContext<'a, 'tcx>, tables: &'a TypeckTables<'tcx>) -> Self {
356357
Self {
357358
cx,
358359
tables,
359-
s: DefaultHasher::new(),
360+
s: StableHasher::new(),
360361
}
361362
}
362363

363-
pub fn finish(&self) -> u64 {
364+
pub fn finish(self) -> u64 {
364365
self.s.finish()
365366
}
366367

@@ -411,15 +412,17 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
411412
self.hash_expr(r);
412413
},
413414
ExprKind::AssignOp(ref o, ref l, ref r) => {
414-
o.hash(&mut self.s);
415+
o.node
416+
.hash_stable(&mut self.cx.tcx.get_stable_hashing_context(), &mut self.s);
415417
self.hash_expr(l);
416418
self.hash_expr(r);
417419
},
418420
ExprKind::Block(ref b, _) => {
419421
self.hash_block(b);
420422
},
421423
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);
423426
self.hash_expr(l);
424427
self.hash_expr(r);
425428
},
@@ -460,7 +463,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
460463
},
461464
ExprKind::InlineAsm(..) | ExprKind::Err => {},
462465
ExprKind::Lit(ref l) => {
463-
l.hash(&mut self.s);
466+
l.node.hash(&mut self.s);
464467
},
465468
ExprKind::Loop(ref b, ref i, _) => {
466469
self.hash_block(b);
@@ -519,7 +522,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
519522
self.hash_exprs(v);
520523
},
521524
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);
523526
self.hash_expr(le);
524527
},
525528
}

0 commit comments

Comments
 (0)