From 9f44caa8579d69e829d89ffaae0260c85141fdfc Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Fri, 10 Jan 2025 04:36:11 +0000 Subject: [PATCH] Do not treat vtable supertraits as distinct when bound with different bound vars --- src/constant.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/constant.rs b/src/constant.rs index 3e7b81a96b68..05ba53430a8a 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>>, ) -> 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) }