From 2a52dc4fbe6a2905f0c81258de204f19bcc3ef9b Mon Sep 17 00:00:00 2001 From: xmakro Date: Tue, 2 Jun 2026 18:13:50 -0700 Subject: [PATCH 1/2] Avoid leaking the query-job collection warning into panic output `collect_active_query_jobs` with `CollectActiveJobsKind::PartialAllowed` is only used to print the query stack when the compiler panics. It intentionally skips any query state shard whose lock it cannot take without waiting, since a complete job map is not needed for that. Under the parallel front-end another thread can still hold a shard lock while the panic is being reported, so the skip happens nondeterministically and the `warn!` was printed into the panic output. Because warnings are shown by default, this leaked a "Failed to collect active jobs" line into the diagnostics of panicking compilations and made their output unstable. Lower the message to `debug!` so it stays available with `RUSTC_LOG` but no longer pollutes the default output. --- compiler/rustc_query_impl/src/execution.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_query_impl/src/execution.rs b/compiler/rustc_query_impl/src/execution.rs index 2f48583f0beed..a237e7610a392 100644 --- a/compiler/rustc_query_impl/src/execution.rs +++ b/compiler/rustc_query_impl/src/execution.rs @@ -14,7 +14,7 @@ use rustc_middle::query::{ use rustc_middle::ty::TyCtxt; use rustc_middle::verify_ich::incremental_verify_ich; use rustc_span::{DUMMY_SP, Span}; -use tracing::warn; +use tracing::debug; use crate::dep_graph::{DepNode, DepNodeIndex}; use crate::handle_cycle_error; @@ -100,7 +100,12 @@ fn collect_active_query_jobs_inner<'tcx, C>( for shard in query.state.active.try_lock_shards() { match shard { Some(shard) => collect_shard_jobs(&shard), - None => warn!("Failed to collect active jobs for query `{}`!", query.name), + // This collection is best-effort (it is only used to print the query + // stack on panic), so a contended shard is expected and fine to skip. + // Emitting this at `warn!` would leak nondeterministically into the + // panic output under the parallel front-end, where another thread may + // still hold a shard lock, so keep it at `debug!`. + None => debug!("Failed to collect active jobs for query `{}`!", query.name), } } } From b6a2d84a4d2f670f4b5a54f1aabf6c950467a81f Mon Sep 17 00:00:00 2001 From: xmakro Date: Wed, 3 Jun 2026 08:50:24 -0700 Subject: [PATCH 2/2] Re-enable the proc-macro repr(packed) ICE test under the parallel front-end This test was marked ignore-parallel-frontend because the panic-time query stack collection could nondeterministically print a "Failed to collect active jobs" warning. With that warning lowered to debug! the ICE output is stable across runs, so replace the directive with a blank line rather than deleting it. The expected stderr is unchanged because the line numbers stay the same. --- tests/ui/resolve/proc_macro_generated_packed.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ui/resolve/proc_macro_generated_packed.rs b/tests/ui/resolve/proc_macro_generated_packed.rs index e35f50911663c..a8175895af04b 100644 --- a/tests/ui/resolve/proc_macro_generated_packed.rs +++ b/tests/ui/resolve/proc_macro_generated_packed.rs @@ -1,6 +1,6 @@ //! This test ICEs because the `repr(packed)` attribute //! was generated by a proc macro, so `#[derive]` didn't see it. -//@ ignore-parallel-frontend failed to collect active jobs + //@proc-macro: proc_macro_generate_packed.rs //@known-bug: #120873 //@ failure-status: 101