Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions compiler/rustc_const_eval/src/interpret/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -608,11 +608,12 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
},
)?;

// Sanity-check that `eval_fn_call` either pushed a new frame or
// did a jump to another block. We disable the sanity check for functions that
// can't return, since Miri sometimes does have to keep the location the same
// for those (which is fine since execution will continue on a different thread).
if target.is_some() && self.frame_idx() == old_stack && self.frame().loc == old_loc

@RalfJung RalfJung Nov 5, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like we don't need the target.is_some() exception any more.

View changes since the review

// Sanity-check that if `eval_fn_call` returns, then it either cleared the entire
// stack (Miri does this for `exit`), pushed a new frame, or did a jump to another
// block.
if !self.stack().is_empty()
&& self.frame_idx() == old_stack
&& self.frame().loc == old_loc
{
span_bug!(terminator.source_info.span, "evaluating this call made no progress");
}
Expand Down
11 changes: 11 additions & 0 deletions src/tools/miri/tests/pass/shims/exit_unit.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// `exit` with `()` return type should not ICE.
// Regression test for <https://github.com/rust-lang/miri/issues/5563>.

#[allow(suspicious_runtime_symbol_definitions)]
unsafe extern "C" {
fn exit(code: i32) -> ();
}

fn main() {
unsafe { exit(0); }
}
Loading