Skip to content

Commit

Permalink
Auto merge of #4715 - rust-lang:rustup, r=phansch
Browse files Browse the repository at this point in the history
Rustup to rust-lang/rust#65647

cc rust-lang/rust#65647

waiting on rust-lang/rust#65690

changelog: none
  • Loading branch information
bors committed Oct 23, 2019
2 parents 1d0f625 + e8d5a9e commit 9a2e500
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions clippy_lints/src/utils/hir_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -348,19 +349,19 @@ 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> {
pub fn new(cx: &'a LateContext<'a, 'tcx>, tables: &'a TypeckTables<'tcx>) -> Self {
Self {
cx,
tables,
s: DefaultHasher::new(),
s: StableHasher::new(),
}
}

pub fn finish(&self) -> u64 {
pub fn finish(self) -> u64 {
self.s.finish()
}

Expand Down Expand Up @@ -411,15 +412,17 @@ 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);
},
ExprKind::Block(ref b, _) => {
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);
},
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
},
}
Expand Down

0 comments on commit 9a2e500

Please sign in to comment.