about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-04-09 00:31:49 -0700
committerbors <bors@rust-lang.org>2016-04-09 00:31:49 -0700
commit42ea682fc495b6ec362db0aafba69e56c7aa0a9c (patch)
tree7f95c90b4e3652ee29e7356b44a93ddce5abb2ec
parentc22302f53f77aa7be34b89bd8b8aafc1b0e673c3 (diff)
parente2921d510dca1def06896bf64afc4d80aa73c608 (diff)
downloadrust-42ea682fc495b6ec362db0aafba69e56c7aa0a9c.tar.gz
rust-42ea682fc495b6ec362db0aafba69e56c7aa0a9c.zip
Auto merge of #32781 - michaelwoerister:dont-use-svh-in-debuginfo, r=alexcrichton
Use crate name/disambiguator instead of SVH for debuginfo typeid.
-rw-r--r--src/librustc_trans/debuginfo/metadata.rs18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/librustc_trans/debuginfo/metadata.rs b/src/librustc_trans/debuginfo/metadata.rs
index 5014186d13b..8471b6a274c 100644
--- a/src/librustc_trans/debuginfo/metadata.rs
+++ b/src/librustc_trans/debuginfo/metadata.rs
@@ -326,7 +326,7 @@ impl<'tcx> TypeMap<'tcx> {
                                             output: &mut String) {
             // First, find out the 'real' def_id of the type. Items inlined from
             // other crates have to be mapped back to their source.
-            let source_def_id = if let Some(node_id) = cx.tcx().map.as_local_node_id(def_id) {
+            let def_id = if let Some(node_id) = cx.tcx().map.as_local_node_id(def_id) {
                 match cx.external_srcs().borrow().get(&node_id).cloned() {
                     Some(source_def_id) => {
                         // The given def_id identifies the inlined copy of a
@@ -339,19 +339,21 @@ impl<'tcx> TypeMap<'tcx> {
                 def_id
             };
 
-            // Get the crate hash as first part of the identifier.
-            let crate_hash = if source_def_id.is_local() {
-                cx.link_meta().crate_hash.clone()
+            // Get the crate name/disambiguator as first part of the identifier.
+            let crate_name = if def_id.is_local() {
+                cx.tcx().crate_name.clone()
             } else {
-                cx.sess().cstore.crate_hash(source_def_id.krate)
+                cx.sess().cstore.original_crate_name(def_id.krate)
             };
+            let crate_disambiguator = cx.tcx().crate_disambiguator(def_id.krate);
 
-            output.push_str(crate_hash.as_str());
+            output.push_str(&crate_name[..]);
             output.push_str("/");
+            output.push_str(&crate_disambiguator[..]);
+            output.push_str("/");
+            // Add the def-index as the second part
             output.push_str(&format!("{:x}", def_id.index.as_usize()));
 
-            // Maybe check that there is no self type here.
-
             let tps = substs.types.get_slice(subst::TypeSpace);
             if !tps.is_empty() {
                 output.push('<');