Skip to content

Commit

Permalink
rustup
Browse files Browse the repository at this point in the history
  • Loading branch information
saethlin committed Apr 10, 2023
1 parent 73702d5 commit d50fee9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
20 changes: 7 additions & 13 deletions src/tools/miri/src/shims/panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,10 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
&[catch_unwind.data.into(), payload.into()],
None,
// Directly return to caller of `try`.
StackPopCleanup::Goto { ret: Some(catch_unwind.ret), unwind: mir::UnwindAction::Continue },
StackPopCleanup::Goto {
ret: Some(catch_unwind.ret),
unwind: mir::UnwindAction::Continue,
},
)?;

// We pushed a new stack frame, the engine should not do any jumping now!
Expand Down Expand Up @@ -211,10 +214,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
Abi::Rust,
&[index.into(), len.into()],
None,
StackPopCleanup::Goto {
ret: None,
unwind,
},
StackPopCleanup::Goto { ret: None, unwind },
)?;
}
MisalignedPointerDereference { required, found } => {
Expand All @@ -235,19 +235,13 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
Abi::Rust,
&[required.into(), found.into()],
None,
StackPopCleanup::Goto {
ret: None,
unwind,
},
StackPopCleanup::Goto { ret: None, unwind },
)?;
}

_ => {
// Forward everything else to `panic` lang item.
this.start_panic(
msg.description(),
unwind,
)?;
this.start_panic(msg.description(), unwind)?;
}
}
Ok(())
Expand Down
4 changes: 3 additions & 1 deletion src/tools/miri/tests/fail/terminate-terminator.stderr
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
warning: You have explicitly enabled MIR optimizations, overriding Miri's default which is to completely disable them. Any optimizations may hide UB that Miri would otherwise detect, and it is not necessarily possible to predict what kind of UB will be missed. If you are enabling optimizations to make Miri run faster, we advise using cfg(miri) to shrink your workload instead. The performance benefit of enabling MIR optimizations is usually marginal at best.

thread 'main' panicked at 'explicit panic', $DIR/terminate-terminator.rs:LL:CC
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: abnormal termination: panic in a function that cannot unwind
Expand All @@ -23,5 +25,5 @@ LL | panic_abort();

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

error: aborting due to previous error
error: aborting due to previous error; 1 warning emitted

0 comments on commit d50fee9

Please sign in to comment.