diff options
Diffstat (limited to 'compiler/rustc_interface/src/util.rs')
| -rw-r--r-- | compiler/rustc_interface/src/util.rs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/compiler/rustc_interface/src/util.rs b/compiler/rustc_interface/src/util.rs index 5cccab893bb..333786f0ca3 100644 --- a/compiler/rustc_interface/src/util.rs +++ b/compiler/rustc_interface/src/util.rs @@ -192,7 +192,18 @@ 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| { + match QueryCtxt::new(tcx).collect_active_jobs() { + Ok(query_map) => query_map, + Err(_) => { + // There was an unexpected error collecting all active jobs, which we need + // to find cycles to break. + // We want to avoid panicking in the deadlock handler, so we abort instead. + eprintln!("internal compiler error: failed to get query map in deadlock handler, aborting process"); + process::abort(); + } + } + }) }) }); let query_map = FromDyn::from(query_map); @@ -201,7 +212,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(); |
