diff options
| author | Michael Goulet <michael@errs.io> | 2025-01-10 04:36:11 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2025-01-30 15:33:58 +0000 |
| commit | fdc4bd22b7b8117f4a3864c342773df600f5b956 (patch) | |
| tree | 404a8293a3401144634e980e436c1b7ca1faac18 /compiler/rustc_codegen_llvm | |
| parent | 37a430e6ea0a674287b53a017497b3414e44b93d (diff) | |
| download | rust-fdc4bd22b7b8117f4a3864c342773df600f5b956.tar.gz rust-fdc4bd22b7b8117f4a3864c342773df600f5b956.zip | |
Do not treat vtable supertraits as distinct when bound with different bound vars
Diffstat (limited to 'compiler/rustc_codegen_llvm')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/common.rs | 7 | ||||
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_llvm/src/common.rs b/compiler/rustc_codegen_llvm/src/common.rs index b4e9b9f44f4..8908ae314b8 100644 --- a/compiler/rustc_codegen_llvm/src/common.rs +++ b/compiler/rustc_codegen_llvm/src/common.rs @@ -312,7 +312,12 @@ impl<'ll, 'tcx> ConstCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> { GlobalAlloc::VTable(ty, dyn_ty) => { let alloc = self .tcx - .global_alloc(self.tcx.vtable_allocation((ty, dyn_ty.principal()))) + .global_alloc(self.tcx.vtable_allocation(( + ty, + dyn_ty.principal().map(|principal| { + self.tcx.instantiate_bound_regions_with_erased(principal) + }), + ))) .unwrap_memory(); let init = const_alloc_to_llvm(self, alloc, /*static*/ false); let value = self.static_addr_of(init, alloc.inner().align, None); diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs index 8d782a618fc..587cb1bef2b 100644 --- a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs +++ b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs @@ -1406,7 +1406,7 @@ fn build_vtable_type_di_node<'ll, 'tcx>( let vtable_entries = if let Some(poly_trait_ref) = poly_trait_ref { let trait_ref = poly_trait_ref.with_self_ty(tcx, ty); - let trait_ref = tcx.erase_regions(trait_ref); + let trait_ref = tcx.erase_regions(tcx.instantiate_bound_regions_with_erased(trait_ref)); tcx.vtable_entries(trait_ref) } else { |
