Cleanup(Option<_>) -> Cleanup(BasicBlock), Skip
This commit is contained in:
@@ -138,7 +138,9 @@ pub struct FrameInfo<'tcx> {
|
|||||||
#[derive(Clone, Copy, Eq, PartialEq, Debug, HashStable)]
|
#[derive(Clone, Copy, Eq, PartialEq, Debug, HashStable)]
|
||||||
pub enum StackPopUnwind {
|
pub enum StackPopUnwind {
|
||||||
/// The cleanup block.
|
/// The cleanup block.
|
||||||
Cleanup(Option<mir::BasicBlock>),
|
Cleanup(mir::BasicBlock),
|
||||||
|
/// No cleanup needs to be done.
|
||||||
|
Skip,
|
||||||
/// Unwinding is not allowed (UB).
|
/// Unwinding is not allowed (UB).
|
||||||
NotAllowed,
|
NotAllowed,
|
||||||
}
|
}
|
||||||
@@ -820,7 +822,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
|||||||
(StackPopCleanup::Goto { unwind, .. }, true) => (
|
(StackPopCleanup::Goto { unwind, .. }, true) => (
|
||||||
true,
|
true,
|
||||||
Some(match unwind {
|
Some(match unwind {
|
||||||
StackPopUnwind::Cleanup(unwind) => unwind,
|
StackPopUnwind::Cleanup(unwind) => Some(unwind),
|
||||||
|
StackPopUnwind::Skip => None,
|
||||||
StackPopUnwind::NotAllowed => {
|
StackPopUnwind::NotAllowed => {
|
||||||
throw_ub_format!("unwind past a frame that does not allow unwinding")
|
throw_ub_format!("unwind past a frame that does not allow unwinding")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -316,10 +316,10 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
|||||||
ret.map(|p| p.0),
|
ret.map(|p| p.0),
|
||||||
StackPopCleanup::Goto {
|
StackPopCleanup::Goto {
|
||||||
ret: ret.map(|p| p.1),
|
ret: ret.map(|p| p.1),
|
||||||
unwind: if can_unwind {
|
unwind: match (unwind, can_unwind) {
|
||||||
StackPopUnwind::Cleanup(unwind)
|
(Some(unwind), true) => StackPopUnwind::Cleanup(unwind),
|
||||||
} else {
|
(None, true) => StackPopUnwind::Skip,
|
||||||
StackPopUnwind::NotAllowed
|
(_, false) => StackPopUnwind::NotAllowed,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
)?;
|
)?;
|
||||||
|
|||||||
Reference in New Issue
Block a user