diff options
| author | bors <bors@rust-lang.org> | 2022-02-10 02:27:43 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-02-10 02:27:43 +0000 |
| commit | 5d6ee0db96aada145725838379f909bbb8aa2312 (patch) | |
| tree | f92e6e48436a2b3b0b6a9521b8dfe6515e3932f8 /compiler/rustc_codegen_ssa/src | |
| parent | e7aca895980f25f6d2d3c48e10fd04656764d1e4 (diff) | |
| parent | 323880646d7595cf10f621163ae3f00a5861867f (diff) | |
| download | rust-5d6ee0db96aada145725838379f909bbb8aa2312.tar.gz rust-5d6ee0db96aada145725838379f909bbb8aa2312.zip | |
Auto merge of #93836 - matthiaskrgr:rollup-d1ssiwl, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - #91443 (Better suggestions when user tries to collect into an unsized `[_]`) - #91504 (`#[used(linker)]` attribute) - #93503 (debuginfo: Fix DW_AT_containing_type vtable debuginfo regression) - #93753 (Complete removal of #[main] attribute from compiler) - #93799 (Fix typo in `std::fmt` docs) - #93813 (Make a few cleanup MIR passes public) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs b/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs index 831c34d8f1f..3cb19c0eec6 100644 --- a/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs +++ b/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs @@ -469,7 +469,14 @@ fn push_debuginfo_type_name<'tcx>( } } -/// Computes a name for the global variable storing a vtable. +pub enum VTableNameKind { + // Is the name for the const/static holding the vtable? + GlobalVariable, + // Is the name for the type of the vtable? + Type, +} + +/// Computes a name for the global variable storing a vtable (or the type of that global variable). /// /// The name is of the form: /// @@ -478,10 +485,15 @@ fn push_debuginfo_type_name<'tcx>( /// or, when generating C++-like names: /// /// `impl$<path::to::SomeType, path::to::SomeTrait>::vtable$` +/// +/// If `kind` is `VTableNameKind::Type` then the last component is `{vtable_ty}` instead of just +/// `{vtable}`, so that the type and the corresponding global variable get assigned different +/// names. pub fn compute_debuginfo_vtable_name<'tcx>( tcx: TyCtxt<'tcx>, t: Ty<'tcx>, trait_ref: Option<ty::PolyExistentialTraitRef<'tcx>>, + kind: VTableNameKind, ) -> String { let cpp_like_debuginfo = cpp_like_debuginfo(tcx); @@ -514,7 +526,12 @@ pub fn compute_debuginfo_vtable_name<'tcx>( push_close_angle_bracket(cpp_like_debuginfo, &mut vtable_name); - let suffix = if cpp_like_debuginfo { "::vtable$" } else { "::{vtable}" }; + let suffix = match (cpp_like_debuginfo, kind) { + (true, VTableNameKind::GlobalVariable) => "::vtable$", + (false, VTableNameKind::GlobalVariable) => "::{vtable}", + (true, VTableNameKind::Type) => "::vtable_type$", + (false, VTableNameKind::Type) => "::{vtable_type}", + }; vtable_name.reserve_exact(suffix.len()); vtable_name.push_str(suffix); |
