1
Fork 0

Add UnwindAction::Terminate

This commit is contained in:
Gary Guo 2022-10-10 22:40:40 +01:00
parent 5e6ed132fa
commit 0a5dac3062
16 changed files with 126 additions and 121 deletions

View file

@ -14,6 +14,7 @@ pub struct MirPatch<'tcx> {
resume_block: Option<BasicBlock>,
// Only for unreachable in cleanup path.
unreachable_block: Option<BasicBlock>,
terminate_block: Option<BasicBlock>,
body_span: Span,
next_local: usize,
}
@ -28,6 +29,7 @@ impl<'tcx> MirPatch<'tcx> {
next_local: body.local_decls.len(),
resume_block: None,
unreachable_block: None,
terminate_block: None,
body_span: body.span,
};

View file

@ -763,6 +763,10 @@ pub enum UnwindAction {
Continue,
/// Triggers undefined behavior if unwind happens.
Unreachable,
/// Terminates the execution if unwind happens.
///
/// Depending on the platform and situation this may cause a non-unwindable panic or abort.
Terminate,
/// Cleanups to be done.
Cleanup(BasicBlock),
}

View file

@ -274,6 +274,7 @@ impl<'tcx> Debug for TerminatorKind<'tcx> {
// Not needed or included in successors
None | Some(UnwindAction::Continue) | Some(UnwindAction::Cleanup(_)) => None,
Some(UnwindAction::Unreachable) => Some("unwind unreachable"),
Some(UnwindAction::Terminate) => Some("unwind terminate"),
};
match (successor_count, unwind) {