about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src/debuginfo
diff options
context:
space:
mode:
authormarmeladema <xademax@gmail.com>2020-08-31 18:11:44 +0100
committermarmeladema <xademax@gmail.com>2020-09-25 22:46:14 +0100
commitf1878d19faf9472f8860a3ff4fe605fdf93cef2c (patch)
tree6fa4b85e5fa946b8dff8b3e4e3b194bdb8f5840c /compiler/rustc_codegen_ssa/src/debuginfo
parentc6e4db620a7d2f569f11dcab627430921ea8aacf (diff)
downloadrust-f1878d19faf9472f8860a3ff4fe605fdf93cef2c.tar.gz
rust-f1878d19faf9472f8860a3ff4fe605fdf93cef2c.zip
Move from {{closure}}#0 syntax to {closure#0} for (def) path components
Diffstat (limited to 'compiler/rustc_codegen_ssa/src/debuginfo')
-rw-r--r--compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs b/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs
index 0c0f1bc681c..e227f9df000 100644
--- a/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs
+++ b/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs
@@ -3,8 +3,11 @@
 use rustc_data_structures::fx::FxHashSet;
 use rustc_hir as hir;
 use rustc_hir::def_id::DefId;
+use rustc_hir::definitions::DefPathDataName;
 use rustc_middle::ty::{self, subst::SubstsRef, Ty, TyCtxt};
 
+use std::fmt::Write;
+
 // Compute the name of the type as it should be stored in debuginfo. Does not do
 // any caching, i.e., calling the function twice with the same type will also do
 // the work twice. The `qualified` parameter only affects the first level of the
@@ -229,7 +232,12 @@ pub fn push_debuginfo_type_name<'tcx>(
             output.push_str(&tcx.crate_name(def_id.krate).as_str());
             for path_element in tcx.def_path(def_id).data {
                 output.push_str("::");
-                output.push_str(&path_element.data.as_symbol().as_str());
+                match path_element.data.get_name() {
+                    DefPathDataName::Named(name) => output.push_str(&name.as_str()),
+                    DefPathDataName::Anon { namespace } => {
+                        write!(output, "{{{{{}}}}}", namespace).unwrap()
+                    }
+                }
             }
         } else {
             output.push_str(&tcx.item_name(def_id).as_str());