use crate::MirPass;
use rustc_data_structures::graph::WithNumNodes;
-use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use rustc_data_structures::sync::Lrc;
use rustc_index::vec::IndexVec;
use rustc_middle::hir;
let source_file = source_map.lookup_source_file(body_span.lo());
let fn_sig_span = match some_fn_sig.filter(|fn_sig| {
- fn_sig.span.ctxt() == body_span.ctxt()
+ fn_sig.span.eq_ctxt(body_span)
&& Lrc::ptr_eq(&source_file, &source_map.lookup_source_file(fn_sig.span.lo()))
}) {
Some(fn_sig) => fn_sig.span.with_hi(body_span.lo()),
fn hash_mir_source<'tcx>(tcx: TyCtxt<'tcx>, hir_body: &'tcx rustc_hir::Body<'tcx>) -> u64 {
// FIXME(cjgillot) Stop hashing HIR manually here.
- let mut hcx = tcx.create_no_span_stable_hashing_context();
- let mut stable_hasher = StableHasher::new();
let owner = hir_body.id().hir_id.owner;
- let bodies = &tcx.hir_owner_nodes(owner).unwrap().bodies;
- hcx.with_hir_bodies(false, owner, bodies, |hcx| {
- hir_body.value.hash_stable(hcx, &mut stable_hasher)
- });
- stable_hasher.finish()
+ tcx.hir_owner_nodes(owner).unwrap().hash_including_bodies.to_smaller_hash()
}