Skip to content

Commit e6793be

Browse files
committed
Print hash of instance instead of span
1 parent fc82914 commit e6793be

File tree

1 file changed

+6
-18
lines changed
  • compiler/rustc_mir/src/monomorphize

1 file changed

+6
-18
lines changed

compiler/rustc_mir/src/monomorphize/util.rs

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
12
use rustc_hir::def_id::LOCAL_CRATE;
23
use rustc_middle::ty::{self, ClosureSizeProfileData, Instance, TyCtxt};
34

@@ -39,23 +40,10 @@ crate fn dump_closure_profile(tcx: TyCtxt<'tcx>, closure_instance: Instance<'tcx
3940
.map(|l| format!("{:?}", l.size.bytes()))
4041
.unwrap_or_else(|e| format!("Failed {:?}", e));
4142

42-
let closure_hir_id = tcx.hir().local_def_id_to_hir_id(closure_def_id.expect_local());
43-
let closure_span = tcx.hir().span(closure_hir_id);
44-
let src_file = tcx.sess.source_map().span_to_filename(closure_span);
45-
let line_nos = tcx
46-
.sess
47-
.source_map()
48-
.span_to_lines(closure_span)
49-
.map(|l| format!("{:?} {:?}", l.lines.first(), l.lines.last()))
50-
.unwrap_or_else(|e| format!("{:?}", e));
51-
52-
eprintln!(
53-
"SG_CRATER_E239478slkdjf: {}, {}, {}, {}, {:?}",
54-
crate_name,
55-
old_size,
56-
new_size,
57-
src_file.prefer_local(),
58-
line_nos
59-
);
43+
let mut hasher = StableHasher::new();
44+
closure_instance.hash_stable(&mut tcx.create_stable_hashing_context(), &mut hasher);
45+
let hash = hasher.finalize();
46+
47+
eprintln!("SG_CR_Eslkdjf: {}, {:x?}, {}, {}", crate_name, hash, old_size, new_size);
6048
}
6149
}

0 commit comments

Comments
 (0)