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
commit9f44caa8579d69e829d89ffaae0260c85141fdfc (patch)
tree8463312dc0dab688922f2fc80739cdeab04e7537
parent7b19e13d324ba932f3e887c1100d18e4e9b353dc (diff)
downloadrust-9f44caa8579d69e829d89ffaae0260c85141fdfc.tar.gz
rust-9f44caa8579d69e829d89ffaae0260c85141fdfc.zip
Do not treat vtable supertraits as distinct when bound with different bound vars
-rw-r--r--src/constant.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/constant.rs b/src/constant.rs
index 3e7b81a96b6..05ba53430a8 100644
--- a/src/constant.rs
+++ b/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)
 }