about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm/debuginfo
diff options
context:
space:
mode:
authorPhilip Craig <philipjcraig@gmail.com>2019-08-25 13:01:46 +1000
committerPhilip Craig <philipjcraig@gmail.com>2019-08-25 13:12:24 +1000
commitfbe3f3e98f1cd5203b18ffacb176c70590390a63 (patch)
tree586c7dfd2b325f991c1770b7f6075dcc7d9854cf /src/librustc_codegen_llvm/debuginfo
parentbea0372a1a7a31b81f28cc4d9a83a2dc9a79d008 (diff)
downloadrust-fbe3f3e98f1cd5203b18ffacb176c70590390a63.tar.gz
rust-fbe3f3e98f1cd5203b18ffacb176c70590390a63.zip
debuginfo: give unique names to closure and generator types
Closure types have been moved to the namespace where they
are defined, and both closure and generator type names now
include the disambiguator.

This fixes an exception when lldb prints nested closures.

Fixes #57822
Diffstat (limited to 'src/librustc_codegen_llvm/debuginfo')
-rw-r--r--src/librustc_codegen_llvm/debuginfo/metadata.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/librustc_codegen_llvm/debuginfo/metadata.rs b/src/librustc_codegen_llvm/debuginfo/metadata.rs
index 51e789b1788..928532a1f47 100644
--- a/src/librustc_codegen_llvm/debuginfo/metadata.rs
+++ b/src/librustc_codegen_llvm/debuginfo/metadata.rs
@@ -683,11 +683,13 @@ pub fn type_metadata(
         }
         ty::Closure(def_id, substs) => {
             let upvar_tys : Vec<_> = substs.upvar_tys(def_id, cx.tcx).collect();
+            let containing_scope = get_namespace_for_item(cx, def_id);
             prepare_tuple_metadata(cx,
                                    t,
                                    &upvar_tys,
                                    unique_type_id,
-                                   usage_site_span).finalize(cx)
+                                   usage_site_span,
+                                   Some(containing_scope)).finalize(cx)
         }
         ty::Generator(def_id, substs,  _) => {
             let upvar_tys : Vec<_> = substs.prefix_tys(def_id, cx.tcx).map(|t| {
@@ -728,7 +730,8 @@ pub fn type_metadata(
                                    t,
                                    &tys,
                                    unique_type_id,
-                                   usage_site_span).finalize(cx)
+                                   usage_site_span,
+                                   NO_SCOPE_METADATA).finalize(cx)
         }
         _ => {
             bug!("debuginfo: unexpected type in type_metadata: {:?}", t)
@@ -1205,6 +1208,7 @@ fn prepare_tuple_metadata(
     component_types: &[Ty<'tcx>],
     unique_type_id: UniqueTypeId,
     span: Span,
+    containing_scope: Option<&'ll DIScope>,
 ) -> RecursiveTypeDescription<'ll, 'tcx> {
     let tuple_name = compute_debuginfo_type_name(cx.tcx, tuple_type, false);
 
@@ -1212,7 +1216,7 @@ fn prepare_tuple_metadata(
                                          tuple_type,
                                          &tuple_name[..],
                                          unique_type_id,
-                                         NO_SCOPE_METADATA);
+                                         containing_scope);
 
     create_and_register_recursive_type_forward_declaration(
         cx,