about summary refs log tree commit diff
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
commit90a6f2b28fa2d1305a0db1e0b802a1a6f0286151 (patch)
treea616e9024d1b7ee77bdc95ed15100359f9ee5e66
parent600999a4fe7af3c7eae9349f6530c5c7b12ce1cd (diff)
downloadrust-90a6f2b28fa2d1305a0db1e0b802a1a6f0286151.tar.gz
rust-90a6f2b28fa2d1305a0db1e0b802a1a6f0286151.zip
Do not treat vtable supertraits as distinct when bound with different bound vars
-rw-r--r--src/common.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/common.rs b/src/common.rs
index bd5d6ba387c..20a3482aaa2 100644
--- a/src/common.rs
+++ b/src/common.rs
@@ -234,7 +234,12 @@ impl<'gcc, 'tcx> ConstCodegenMethods<'tcx> for CodegenCx<'gcc, '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_gcc(self, alloc);
                         self.static_addr_of(init, alloc.inner().align, None)