about summary refs log tree commit diff
path: root/compiler/rustc_codegen_cranelift
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2025-01-10 04:36:11 +0000
committerMichael Goulet <michael@errs.io>2025-01-30 15:33:58 +0000
commitfdc4bd22b7b8117f4a3864c342773df600f5b956 (patch)
tree404a8293a3401144634e980e436c1b7ca1faac18 /compiler/rustc_codegen_cranelift
parent37a430e6ea0a674287b53a017497b3414e44b93d (diff)
Do not treat vtable supertraits as distinct when bound with different bound vars
Diffstat (limited to 'compiler/rustc_codegen_cranelift')
-rw-r--r--compiler/rustc_codegen_cranelift/src/constant.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_cranelift/src/constant.rs b/compiler/rustc_codegen_cranelift/src/constant.rs
index 3e7b81a96b6..05ba53430a8 100644
--- a/compiler/rustc_codegen_cranelift/src/constant.rs
+++ b/compiler/rustc_codegen_cranelift/src/constant.rs
@@ -245,7 +245,10 @@ pub(crate) fn data_id_for_vtable<'tcx>(
     ty: Ty<'tcx>,
     trait_ref: Option<Binder<'tcx, ExistentialTraitRef<'tcx>>>,
 ) -> DataId {
-    let alloc_id = tcx.vtable_allocation((ty, trait_ref));
+    let alloc_id = tcx.vtable_allocation((
+        ty,
+        trait_ref.map(|principal| tcx.instantiate_bound_regions_with_erased(principal)),
+    ));
     data_id_for_alloc_id(cx, module, alloc_id, Mutability::Not)
 }