Rollup merge of #99673 - RalfJung:interpret-invalid-dyn, r=oli-obk
don't ICE on invalid dyn calls Due to https://github.com/rust-lang/rust/issues/50781 this is actually reachable. Fixes https://github.com/rust-lang/miri/issues/2432 r? ``@oli-obk``
This commit is contained in:
commit
2973b00ca6
1 changed files with 2 additions and 2 deletions
|
@ -571,8 +571,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
|||
|
||||
// Now determine the actual method to call. We can do that in two different ways and
|
||||
// compare them to ensure everything fits.
|
||||
let ty::VtblEntry::Method(fn_inst) = self.get_vtable_entries(vptr)?[idx] else {
|
||||
span_bug!(self.cur_span(), "dyn call index points at something that is not a method")
|
||||
let Some(ty::VtblEntry::Method(fn_inst)) = self.get_vtable_entries(vptr)?.get(idx).copied() else {
|
||||
throw_ub_format!("`dyn` call trying to call something that is not a method")
|
||||
};
|
||||
if cfg!(debug_assertions) {
|
||||
let tcx = *self.tcx;
|
||||
|
|
Loading…
Add table
Reference in a new issue