Add UnwindAction::Unreachable
This also makes eval machine's `StackPopUnwind` redundant so that is replaced.
This commit is contained in:
parent
daeb844e0c
commit
5e6ed132fa
23 changed files with 160 additions and 149 deletions
|
@ -1612,23 +1612,13 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
|||
TerminatorKind::Drop { target, unwind, .. }
|
||||
| TerminatorKind::Assert { target, unwind, .. } => {
|
||||
self.assert_iscleanup(body, block_data, target, is_cleanup);
|
||||
if let UnwindAction::Cleanup(unwind) = unwind {
|
||||
if is_cleanup {
|
||||
span_mirbug!(self, block_data, "unwind on cleanup block")
|
||||
}
|
||||
self.assert_iscleanup(body, block_data, unwind, true);
|
||||
}
|
||||
self.assert_iscleanup_unwind(body, block_data, unwind, is_cleanup);
|
||||
}
|
||||
TerminatorKind::Call { ref target, unwind, .. } => {
|
||||
if let &Some(target) = target {
|
||||
self.assert_iscleanup(body, block_data, target, is_cleanup);
|
||||
}
|
||||
if let UnwindAction::Cleanup(cleanup) = unwind {
|
||||
if is_cleanup {
|
||||
span_mirbug!(self, block_data, "cleanup on cleanup block")
|
||||
}
|
||||
self.assert_iscleanup(body, block_data, cleanup, true);
|
||||
}
|
||||
self.assert_iscleanup_unwind(body, block_data, unwind, is_cleanup);
|
||||
}
|
||||
TerminatorKind::FalseEdge { real_target, imaginary_target } => {
|
||||
self.assert_iscleanup(body, block_data, real_target, is_cleanup);
|
||||
|
@ -1636,23 +1626,13 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
|||
}
|
||||
TerminatorKind::FalseUnwind { real_target, unwind } => {
|
||||
self.assert_iscleanup(body, block_data, real_target, is_cleanup);
|
||||
if let UnwindAction::Cleanup(unwind) = unwind {
|
||||
if is_cleanup {
|
||||
span_mirbug!(self, block_data, "cleanup in cleanup block via false unwind");
|
||||
}
|
||||
self.assert_iscleanup(body, block_data, unwind, true);
|
||||
}
|
||||
self.assert_iscleanup_unwind(body, block_data, unwind, is_cleanup);
|
||||
}
|
||||
TerminatorKind::InlineAsm { destination, unwind, .. } => {
|
||||
if let Some(target) = destination {
|
||||
self.assert_iscleanup(body, block_data, target, is_cleanup);
|
||||
}
|
||||
if let UnwindAction::Cleanup(cleanup) = unwind {
|
||||
if is_cleanup {
|
||||
span_mirbug!(self, block_data, "cleanup on cleanup block")
|
||||
}
|
||||
self.assert_iscleanup(body, block_data, cleanup, true);
|
||||
}
|
||||
self.assert_iscleanup_unwind(body, block_data, unwind, is_cleanup);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1669,6 +1649,25 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
fn assert_iscleanup_unwind(
|
||||
&mut self,
|
||||
body: &Body<'tcx>,
|
||||
ctxt: &dyn fmt::Debug,
|
||||
unwind: UnwindAction,
|
||||
is_cleanup: bool,
|
||||
) {
|
||||
match unwind {
|
||||
UnwindAction::Cleanup(unwind) => {
|
||||
if is_cleanup {
|
||||
span_mirbug!(self, ctxt, "unwind on cleanup block")
|
||||
}
|
||||
self.assert_iscleanup(body, ctxt, unwind, true);
|
||||
}
|
||||
UnwindAction::Continue => (),
|
||||
UnwindAction::Unreachable => (),
|
||||
}
|
||||
}
|
||||
|
||||
fn check_local(&mut self, body: &Body<'tcx>, local: Local, local_decl: &LocalDecl<'tcx>) {
|
||||
match body.local_kind(local) {
|
||||
LocalKind::ReturnPointer | LocalKind::Arg => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue