Skip to content

Commit

Permalink
we are on 2018 edition, use try block
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Mar 11, 2020
1 parent d8f8168 commit 9681422
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/librustc_mir/interpret/terminator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,9 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
StackPopCleanup::Goto { ret: ret.map(|p| p.1), unwind },
)?;

// We want to pop this frame again in case there was an error, to put
// the blame in the right location. Until the 2018 edition is used in
// the compiler, we have to do this with an immediately invoked function.
let res = (|| {
// If an error is raised here, pop the frame again to get an accurate backtrace.
// To this end, we wrap it all in a `try` block.
let res: InterpResult<'tcx> = try {
trace!(
"caller ABI: {:?}, args: {:#?}",
caller_abi,
Expand Down Expand Up @@ -363,8 +362,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
throw_ub_format!("calling a returning function without a return place")
}
}
Ok(())
})();
};
match res {
Err(err) => {
self.stack.pop();
Expand Down

0 comments on commit 9681422

Please sign in to comment.