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
committerPietro Albini <pietro@pietroalbini.org>2019-09-02 17:26:50 +0200
commit7014774fd014fb19d135f2f92dbaed46073d9c64 (patch)
treec6bf78bfd1577643dc78290137d89ba83a834212 /src/librustc_codegen_llvm/debuginfo
parenta06cba20cf55f9131bdfd8744d0bc6444ff1c4fe (diff)
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,