Skip to content

Commit 631ab21

Browse files
Check vtable projections for validity in miri
1 parent 9d8572d commit 631ab21

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/constant.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,13 @@ pub(crate) fn codegen_const_value<'tcx>(
161161
fx.module.declare_func_in_func(func_id, &mut fx.bcx.func);
162162
fx.bcx.ins().func_addr(fx.pointer_type, local_func_id)
163163
}
164-
GlobalAlloc::VTable(ty, trait_ref) => {
164+
GlobalAlloc::VTable(ty, dyn_ty) => {
165165
let data_id = data_id_for_vtable(
166166
fx.tcx,
167167
&mut fx.constants_cx,
168168
fx.module,
169169
ty,
170-
trait_ref,
170+
dyn_ty.principal(),
171171
);
172172
let local_data_id =
173173
fx.module.declare_data_in_func(data_id, &mut fx.bcx.func);
@@ -456,8 +456,8 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut dyn Module, cx: &mut Constant
456456
GlobalAlloc::Memory(target_alloc) => {
457457
data_id_for_alloc_id(cx, module, alloc_id, target_alloc.inner().mutability)
458458
}
459-
GlobalAlloc::VTable(ty, trait_ref) => {
460-
data_id_for_vtable(tcx, cx, module, ty, trait_ref)
459+
GlobalAlloc::VTable(ty, dyn_ty) => {
460+
data_id_for_vtable(tcx, cx, module, ty, dyn_ty.principal())
461461
}
462462
GlobalAlloc::Static(def_id) => {
463463
if tcx.codegen_fn_attrs(def_id).flags.contains(CodegenFnAttrFlags::THREAD_LOCAL)

0 commit comments

Comments
 (0)