diff options
| author | bors <bors@rust-lang.org> | 2019-10-23 10:35:17 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-10-23 10:35:17 +0000 |
| commit | 9a2e500928538e3ba91c467ea577fcfa8ca5bb6e (patch) | |
| tree | f74b31057dfb9451bd1bd87d3d848c9340478383 | |
| parent | 1d0f62570b2f58b09b991f7312dd1f1564c613f0 (diff) | |
| parent | e8d5a9e95c145a3a9be89c582d8a6f88d4ea7037 (diff) | |
| download | rust-9a2e500928538e3ba91c467ea577fcfa8ca5bb6e.tar.gz rust-9a2e500928538e3ba91c467ea577fcfa8ca5bb6e.zip | |
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
| -rw-r--r-- | clippy_lints/src/utils/hir_utils.rs | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/clippy_lints/src/utils/hir_utils.rs b/clippy_lints/src/utils/hir_utils.rs index 0e8fcf8fd0f..d8b20a5df61 100644 --- a/clippy_lints/src/utils/hir_utils.rs +++ b/clippy_lints/src/utils/hir_utils.rs @@ -2,10 +2,11 @@ use crate::consts::{constant_context, constant_simple}; use crate::utils::differing_macro_contexts; use rustc::hir::ptr::P; use rustc::hir::*; +use rustc::ich::StableHashingContextProvider; use rustc::lint::LateContext; use rustc::ty::TypeckTables; -use std::collections::hash_map::DefaultHasher; -use std::hash::{Hash, Hasher}; +use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; +use std::hash::Hash; use syntax::ast::Name; /// Type used to check whether two ast are the same. This is different from the @@ -348,7 +349,7 @@ pub struct SpanlessHash<'a, 'tcx> { /// Context used to evaluate constant expressions. cx: &'a LateContext<'a, 'tcx>, tables: &'a TypeckTables<'tcx>, - s: DefaultHasher, + s: StableHasher, } impl<'a, 'tcx> SpanlessHash<'a, 'tcx> { @@ -356,11 +357,11 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> { Self { cx, tables, - s: DefaultHasher::new(), + s: StableHasher::new(), } } - pub fn finish(&self) -> u64 { + pub fn finish(self) -> u64 { self.s.finish() } @@ -411,7 +412,8 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> { self.hash_expr(r); }, ExprKind::AssignOp(ref o, ref l, ref r) => { - o.hash(&mut self.s); + o.node + .hash_stable(&mut self.cx.tcx.get_stable_hashing_context(), &mut self.s); self.hash_expr(l); self.hash_expr(r); }, @@ -419,7 +421,8 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> { self.hash_block(b); }, ExprKind::Binary(op, ref l, ref r) => { - op.node.hash(&mut self.s); + op.node + .hash_stable(&mut self.cx.tcx.get_stable_hashing_context(), &mut self.s); self.hash_expr(l); self.hash_expr(r); }, @@ -460,7 +463,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> { }, ExprKind::InlineAsm(..) | ExprKind::Err => {}, ExprKind::Lit(ref l) => { - l.hash(&mut self.s); + l.node.hash(&mut self.s); }, ExprKind::Loop(ref b, ref i, _) => { self.hash_block(b); @@ -519,7 +522,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> { self.hash_exprs(v); }, ExprKind::Unary(lop, ref le) => { - lop.hash(&mut self.s); + lop.hash_stable(&mut self.cx.tcx.get_stable_hashing_context(), &mut self.s); self.hash_expr(le); }, } |
