don't ICE on invalid dyn calls
This commit is contained in:
parent
b4151a41a0
commit
f80bf1013d
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
|
// Now determine the actual method to call. We can do that in two different ways and
|
||||||
// compare them to ensure everything fits.
|
// compare them to ensure everything fits.
|
||||||
let ty::VtblEntry::Method(fn_inst) = self.get_vtable_entries(vptr)?[idx] else {
|
let Some(ty::VtblEntry::Method(fn_inst)) = self.get_vtable_entries(vptr)?.get(idx).copied() else {
|
||||||
span_bug!(self.cur_span(), "dyn call index points at something that is not a method")
|
throw_ub_format!("`dyn` call trying to call something that is not a method")
|
||||||
};
|
};
|
||||||
if cfg!(debug_assertions) {
|
if cfg!(debug_assertions) {
|
||||||
let tcx = *self.tcx;
|
let tcx = *self.tcx;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue