Skip to content

Commit 42ea682

Browse files
committed
Auto merge of #32781 - michaelwoerister:dont-use-svh-in-debuginfo, r=alexcrichton
Use crate name/disambiguator instead of SVH for debuginfo typeid.
2 parents c22302f + e2921d5 commit 42ea682

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/librustc_trans/debuginfo/metadata.rs

+10-8
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ impl<'tcx> TypeMap<'tcx> {
326326
output: &mut String) {
327327
// First, find out the 'real' def_id of the type. Items inlined from
328328
// other crates have to be mapped back to their source.
329-
let source_def_id = if let Some(node_id) = cx.tcx().map.as_local_node_id(def_id) {
329+
let def_id = if let Some(node_id) = cx.tcx().map.as_local_node_id(def_id) {
330330
match cx.external_srcs().borrow().get(&node_id).cloned() {
331331
Some(source_def_id) => {
332332
// The given def_id identifies the inlined copy of a
@@ -339,19 +339,21 @@ impl<'tcx> TypeMap<'tcx> {
339339
def_id
340340
};
341341

342-
// Get the crate hash as first part of the identifier.
343-
let crate_hash = if source_def_id.is_local() {
344-
cx.link_meta().crate_hash.clone()
342+
// Get the crate name/disambiguator as first part of the identifier.
343+
let crate_name = if def_id.is_local() {
344+
cx.tcx().crate_name.clone()
345345
} else {
346-
cx.sess().cstore.crate_hash(source_def_id.krate)
346+
cx.sess().cstore.original_crate_name(def_id.krate)
347347
};
348+
let crate_disambiguator = cx.tcx().crate_disambiguator(def_id.krate);
348349

349-
output.push_str(crate_hash.as_str());
350+
output.push_str(&crate_name[..]);
350351
output.push_str("/");
352+
output.push_str(&crate_disambiguator[..]);
353+
output.push_str("/");
354+
// Add the def-index as the second part
351355
output.push_str(&format!("{:x}", def_id.index.as_usize()));
352356

353-
// Maybe check that there is no self type here.
354-
355357
let tps = substs.types.get_slice(subst::TypeSpace);
356358
if !tps.is_empty() {
357359
output.push('<');

0 commit comments

Comments
 (0)