about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src/debuginfo
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2022-03-05 07:28:41 +1100
committerNicholas Nethercote <n.nethercote@gmail.com>2022-03-11 13:31:24 +1100
commitca5525d5643f4eb7de5c5e69d0691fc8f1cacfca (patch)
treecbe3682d3e3ff0d1a48b76f972f0322ea28c9542 /compiler/rustc_codegen_ssa/src/debuginfo
parent5f4e0677190b82e61dc507e3e72caf89da8e5e28 (diff)
downloadrust-ca5525d5643f4eb7de5c5e69d0691fc8f1cacfca.tar.gz
rust-ca5525d5643f4eb7de5c5e69d0691fc8f1cacfca.zip
Improve `AdtDef` interning.
This commit makes `AdtDef` use `Interned`. Much the commit is tedious
changes to introduce getter functions. The interesting changes are in
`compiler/rustc_middle/src/ty/adt.rs`.
Diffstat (limited to 'compiler/rustc_codegen_ssa/src/debuginfo')
-rw-r--r--compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs b/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs
index 62a297937d4..67df64e9b1b 100644
--- a/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs
+++ b/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs
@@ -74,7 +74,7 @@ fn push_debuginfo_type_name<'tcx>(
             if def.is_enum() && cpp_like_debuginfo {
                 msvc_enum_fallback(tcx, t, def, substs, output, visited);
             } else {
-                push_item_name(tcx, def.did, qualified, output);
+                push_item_name(tcx, def.did(), qualified, output);
                 push_generic_params_internal(tcx, substs, output, visited);
             }
         }
@@ -405,15 +405,15 @@ fn push_debuginfo_type_name<'tcx>(
     fn msvc_enum_fallback<'tcx>(
         tcx: TyCtxt<'tcx>,
         ty: Ty<'tcx>,
-        def: &AdtDef,
+        def: AdtDef<'tcx>,
         substs: SubstsRef<'tcx>,
         output: &mut String,
         visited: &mut FxHashSet<Ty<'tcx>>,
     ) {
-        let layout = tcx.layout_of(tcx.param_env(def.did).and(ty)).expect("layout error");
+        let layout = tcx.layout_of(tcx.param_env(def.did()).and(ty)).expect("layout error");
 
         output.push_str("enum$<");
-        push_item_name(tcx, def.did, true, output);
+        push_item_name(tcx, def.did(), true, output);
         push_generic_params_internal(tcx, substs, output, visited);
 
         if let Variants::Multiple {
@@ -435,14 +435,14 @@ fn push_debuginfo_type_name<'tcx>(
             let max = dataful_discriminant_range.end;
             let max = tag.value.size(&tcx).truncate(max);
 
-            let dataful_variant_name = def.variants[*dataful_variant].name.as_str();
+            let dataful_variant_name = def.variant(*dataful_variant).name.as_str();
 
             output.push_str(&format!(", {}, {}, {}", min, max, dataful_variant_name));
         } else if let Variants::Single { index: variant_idx } = &layout.variants {
             // Uninhabited enums can't be constructed and should never need to be visualized so
             // skip this step for them.
-            if def.variants.len() != 0 {
-                let variant = def.variants[*variant_idx].name.as_str();
+            if def.variants().len() != 0 {
+                let variant = def.variant(*variant_idx).name.as_str();
 
                 output.push_str(&format!(", {}", variant));
             }