Skip to content

Commit ca2aab6

Browse files
committed
Auto merge of #3416 - rust-lang:rustup-2024-03-26, r=RalfJung
Automatic Rustup
2 parents c941fcd + 9d7d916 commit ca2aab6

File tree

3 files changed

+8
-15
lines changed

3 files changed

+8
-15
lines changed

rust-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
cb7c63606e53715f94f3ba04d38e50772e4cd23d
1+
8b9e47c136aeee998effdcae356e134b8de65891

src/bin/miri.rs

+4
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,10 @@ fn main() {
364364
let args = rustc_driver::args::raw_args(&early_dcx)
365365
.unwrap_or_else(|_| std::process::exit(rustc_driver::EXIT_FAILURE));
366366

367+
// Install the ctrlc handler that sets `rustc_const_eval::CTRL_C_RECEIVED`, even if
368+
// MIRI_BE_RUSTC is set.
369+
rustc_driver::install_ctrlc_handler();
370+
367371
// If the environment asks us to actually be rustc, then do that.
368372
if let Some(crate_kind) = env::var_os("MIRI_BE_RUSTC") {
369373
// Earliest rustc setup.

src/concurrency/thread.rs

+3-14
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
use std::cell::RefCell;
44
use std::collections::hash_map::Entry;
55
use std::num::TryFromIntError;
6-
use std::sync::atomic::{AtomicBool, Ordering::Relaxed};
6+
use std::sync::atomic::Ordering::Relaxed;
77
use std::task::Poll;
88
use std::time::{Duration, SystemTime};
99

1010
use either::Either;
1111

12+
use rustc_const_eval::CTRL_C_RECEIVED;
1213
use rustc_data_structures::fx::FxHashMap;
1314
use rustc_hir::def_id::DefId;
1415
use rustc_index::{Idx, IndexVec};
@@ -1045,21 +1046,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
10451046
/// Run the core interpreter loop. Returns only when an interrupt occurs (an error or program
10461047
/// termination).
10471048
fn run_threads(&mut self) -> InterpResult<'tcx, !> {
1048-
static SIGNALED: AtomicBool = AtomicBool::new(false);
1049-
ctrlc::set_handler(move || {
1050-
// Indicate that we have ben signaled to stop. If we were already signaled, exit
1051-
// immediately. In our interpreter loop we try to consult this value often, but if for
1052-
// whatever reason we don't get to that check or the cleanup we do upon finding that
1053-
// this bool has become true takes a long time, the exit here will promptly exit the
1054-
// process on the second Ctrl-C.
1055-
if SIGNALED.swap(true, Relaxed) {
1056-
std::process::exit(1);
1057-
}
1058-
})
1059-
.unwrap();
10601049
let this = self.eval_context_mut();
10611050
loop {
1062-
if SIGNALED.load(Relaxed) {
1051+
if CTRL_C_RECEIVED.load(Relaxed) {
10631052
this.machine.handle_abnormal_termination();
10641053
std::process::exit(1);
10651054
}

0 commit comments

Comments
 (0)