Skip to content

Commit afabaf3

Browse files
committed
Auto merge of #1771 - vakaras:bug-1763, r=RalfJung
Attempt to fix #1763 As discussed on issue #1763, just try asking the scheduler to try again. Fixes #1763
2 parents 1ae7bfc + 50f68dc commit afabaf3

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/thread.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,17 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
711711
fn run_timeout_callback(&mut self) -> InterpResult<'tcx> {
712712
let this = self.eval_context_mut();
713713
let (thread, callback) =
714-
this.machine.threads.get_ready_callback().expect("no callback found");
714+
if let Some((thread, callback)) = this.machine.threads.get_ready_callback() {
715+
(thread, callback)
716+
} else {
717+
// get_ready_callback can return None if the computer's clock
718+
// was shifted after calling the scheduler and before the call
719+
// to get_ready_callback (see issue
720+
// https://github.com/rust-lang/miri/issues/1763). In this case,
721+
// just do nothing, which effectively just returns to the
722+
// scheduler.
723+
return Ok(());
724+
};
715725
// This back-and-forth with `set_active_thread` is here because of two
716726
// design decisions:
717727
// 1. Make the caller and not the callback responsible for changing

0 commit comments

Comments
 (0)