Skip to content

Commit e2921d5

Browse files
Use crate name/disambiguator instead of SVH for debuginfo typeid.
1 parent 943ec3b commit e2921d5

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
@@ -324,7 +324,7 @@ impl<'tcx> TypeMap<'tcx> {
324324
output: &mut String) {
325325
// First, find out the 'real' def_id of the type. Items inlined from
326326
// other crates have to be mapped back to their source.
327-
let source_def_id = if let Some(node_id) = cx.tcx().map.as_local_node_id(def_id) {
327+
let def_id = if let Some(node_id) = cx.tcx().map.as_local_node_id(def_id) {
328328
match cx.external_srcs().borrow().get(&node_id).cloned() {
329329
Some(source_def_id) => {
330330
// The given def_id identifies the inlined copy of a
@@ -337,19 +337,21 @@ impl<'tcx> TypeMap<'tcx> {
337337
def_id
338338
};
339339

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

347-
output.push_str(crate_hash.as_str());
348+
output.push_str(&crate_name[..]);
348349
output.push_str("/");
350+
output.push_str(&crate_disambiguator[..]);
351+
output.push_str("/");
352+
// Add the def-index as the second part
349353
output.push_str(&format!("{:x}", def_id.index.as_usize()));
350354

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

0 commit comments

Comments
 (0)