about summary refs log tree commit diff
path: root/compiler/rustc_interface/src
diff options
context:
space:
mode:
authorJohn Kåre Alsaker <john.kare.alsaker@gmail.com>2025-03-16 23:59:10 +0100
committerJohn Kåre Alsaker <john.kare.alsaker@gmail.com>2025-03-21 07:37:56 +0100
commit077b8d5c370391d428dbb4d3d037f6e51b1349a8 (patch)
treee0b7e98899babc4a2fc12ee6731e66488afff3b5 /compiler/rustc_interface/src
parent01dc45c10e814c25207995a577359e3f137e78ae (diff)
downloadrust-077b8d5c370391d428dbb4d3d037f6e51b1349a8.tar.gz
rust-077b8d5c370391d428dbb4d3d037f6e51b1349a8.zip
Abort in deadlock handler if we fail to get a query map
Diffstat (limited to 'compiler/rustc_interface/src')
-rw-r--r--compiler/rustc_interface/src/util.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/compiler/rustc_interface/src/util.rs b/compiler/rustc_interface/src/util.rs
index 5cccab893bb..0904795529e 100644
--- a/compiler/rustc_interface/src/util.rs
+++ b/compiler/rustc_interface/src/util.rs
@@ -192,7 +192,16 @@ pub(crate) fn run_in_thread_pool_with_globals<F: FnOnce(CurrentGcx) -> R + Send,
             // `TyCtxt` TLS reference here.
             let query_map = current_gcx2.access(|gcx| {
                 tls::enter_context(&tls::ImplicitCtxt::new(gcx), || {
-                    tls::with(|tcx| QueryCtxt::new(tcx).collect_active_jobs())
+                    tls::with(|tcx| {
+                        let (query_map, complete) = QueryCtxt::new(tcx).collect_active_jobs();
+                        if !complete {
+                            eprintln!("internal compiler error: failed to get query map in deadlock handler, aborting process");
+                            // We need to abort here as we failed to resolve the deadlock,
+                            // otherwise the compiler could just hang,
+                            process::abort();
+                        }
+                        query_map
+                    })
                 })
             });
             let query_map = FromDyn::from(query_map);
@@ -201,7 +210,7 @@ pub(crate) fn run_in_thread_pool_with_globals<F: FnOnce(CurrentGcx) -> R + Send,
                 .name("rustc query cycle handler".to_string())
                 .spawn(move || {
                     let on_panic = defer(|| {
-                        eprintln!("query cycle handler thread panicked, aborting process");
+                        eprintln!("internal compiler error: query cycle handler thread panicked, aborting process");
                         // We need to abort here as we failed to resolve the deadlock,
                         // otherwise the compiler could just hang,
                         process::abort();