miri: add machine hook for Abort terminator
This commit is contained in:
parent
4897594656
commit
8a8870fbae
2 changed files with 12 additions and 2 deletions
|
|
@ -170,6 +170,11 @@ pub trait Machine<'mir, 'tcx>: Sized {
|
|||
unwind: Option<mir::BasicBlock>,
|
||||
) -> InterpResult<'tcx>;
|
||||
|
||||
/// Called to evaluate `Abort` MIR terminator.
|
||||
fn abort(_ecx: &mut InterpCx<'mir, 'tcx, Self>) -> InterpResult<'tcx> {
|
||||
throw_unsup_format!("aborting execution is not supported");
|
||||
}
|
||||
|
||||
/// Called for all binary operations where the LHS has pointer type.
|
||||
///
|
||||
/// Returns a (value, overflowed) pair if the operation succeeded
|
||||
|
|
|
|||
|
|
@ -99,6 +99,10 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
|||
}
|
||||
}
|
||||
|
||||
Abort => {
|
||||
M::abort(self)?;
|
||||
}
|
||||
|
||||
// When we encounter Resume, we've finished unwinding
|
||||
// cleanup for the current stack frame. We pop it in order
|
||||
// to continue unwinding the next frame
|
||||
|
|
@ -118,8 +122,9 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
|||
| FalseEdges { .. }
|
||||
| FalseUnwind { .. }
|
||||
| Yield { .. }
|
||||
| GeneratorDrop
|
||||
| Abort => bug!("{:#?} should have been eliminated by MIR pass", terminator.kind),
|
||||
| GeneratorDrop => {
|
||||
bug!("{:#?} should have been eliminated by MIR pass", terminator.kind)
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue