Skip to content

Commit 8977616

Browse files
committed
Update to accomondate vtable mono changes upstream
1 parent 74fee6c commit 8977616

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

src/monomorphize_collector.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -937,11 +937,13 @@ fn create_mono_items_for_vtable_methods<'tcx>(
937937

938938
if let ty::Dynamic(ref trait_ty, ..) = trait_ty.kind() {
939939
if let Some(principal) = trait_ty.principal() {
940-
let poly_trait_ref = principal.with_self_ty(tcx, impl_ty);
941-
assert!(!poly_trait_ref.has_escaping_bound_vars());
940+
let trait_ref =
941+
tcx.instantiate_bound_regions_with_erased(principal.with_self_ty(tcx, impl_ty));
942+
assert!(!trait_ref.has_escaping_bound_vars());
942943

943944
// Walk all methods of the trait, including those of its supertraits
944-
let entries = tcx.vtable_entries(poly_trait_ref);
945+
let entries = tcx.vtable_entries(trait_ref);
946+
debug!(?entries);
945947
let methods = entries
946948
.iter()
947949
.filter_map(|entry| match entry {
@@ -1186,7 +1188,12 @@ fn collect_alloc<'tcx>(
11861188
output.push(create_fn_mono_item(tcx, instance, DUMMY_SP));
11871189
}
11881190
GlobalAlloc::VTable(ty, dyn_ty) => {
1189-
let alloc_id = tcx.vtable_allocation((ty, dyn_ty.principal()));
1191+
let alloc_id = tcx.vtable_allocation((
1192+
ty,
1193+
dyn_ty
1194+
.principal()
1195+
.map(|principal| tcx.instantiate_bound_regions_with_erased(principal)),
1196+
));
11901197
collect_alloc(tcx, alloc_id, output)
11911198
}
11921199
}

0 commit comments

Comments
 (0)