1
Fork 0

Fix tools

This commit is contained in:
Gary Guo 2022-10-10 23:17:07 +01:00
parent 3af45d6c57
commit 5cbda2a55e
2 changed files with 2 additions and 1 deletions

View file

@ -737,6 +737,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
throw_ub_format!("unwinding past a stack frame that does not allow unwinding") throw_ub_format!("unwinding past a stack frame that does not allow unwinding")
} }
mir::UnwindAction::Terminate => { mir::UnwindAction::Terminate => {
self.frame_mut().loc = Right(self.frame_mut().body.span);
M::abort(self, "panic in a function that cannot unwind".to_owned())?; M::abort(self, "panic in a function that cannot unwind".to_owned())?;
} }
}; };

View file

@ -301,13 +301,13 @@ fn check_terminator<'tcx>(
| TerminatorKind::Goto { .. } | TerminatorKind::Goto { .. }
| TerminatorKind::Return | TerminatorKind::Return
| TerminatorKind::Resume | TerminatorKind::Resume
| TerminatorKind::Terminate
| TerminatorKind::Unreachable => Ok(()), | TerminatorKind::Unreachable => Ok(()),
TerminatorKind::Drop { place, .. } => check_place(tcx, *place, span, body), TerminatorKind::Drop { place, .. } => check_place(tcx, *place, span, body),
TerminatorKind::SwitchInt { discr, targets: _ } => check_operand(tcx, discr, span, body), TerminatorKind::SwitchInt { discr, targets: _ } => check_operand(tcx, discr, span, body),
TerminatorKind::Abort => Err((span, "abort is not stable in const fn".into())),
TerminatorKind::GeneratorDrop | TerminatorKind::Yield { .. } => { TerminatorKind::GeneratorDrop | TerminatorKind::Yield { .. } => {
Err((span, "const fn generators are unstable".into())) Err((span, "const fn generators are unstable".into()))
}, },