mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Streamline active job collection.
`collect_active_jobs_from_all_queries` takes a `require_complete` bool, and then some callers `expect` a full map result while others allow a partial map result. The end result is four possible combinations, but only three of them are used/make sense. This commit introduces `CollectActiveJobsKind`, a three-value enum that describes the three sensible combinations, and rewrites `collect_active_jobs_from_all_queries` around it. This makes it and its call sites much clearer, and removes the weird `Option<()>` and `Result<QueryJobMap, QueryJobMap>` return types. Other changes of note. - `active` is removed. The comment about `make_frame` is out of date, and `create_deferred_query_stack_frame` *is* safe to call with the query state locked. - When shard locking failure is allowed, collection no longer stops on the first failed shard.
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
use rustc_metadata::{DylibError, EncodedMetadata, load_symbol_from_dylib};
|
||||
use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
|
||||
use rustc_middle::ty::{CurrentGcx, TyCtxt};
|
||||
use rustc_query_impl::collect_active_jobs_from_all_queries;
|
||||
use rustc_query_impl::{CollectActiveJobsKind, collect_active_jobs_from_all_queries};
|
||||
use rustc_session::config::{
|
||||
Cfg, CrateType, OutFileName, OutputFilenames, OutputTypes, Sysroot, host_tuple,
|
||||
};
|
||||
@@ -253,9 +253,11 @@ pub(crate) fn run_in_thread_pool_with_globals<
|
||||
unsafe { &*(session_globals as *const SessionGlobals) },
|
||||
|| {
|
||||
// Ensure there were no errors collecting all active jobs.
|
||||
// We need the complete map to ensure we find a cycle to break.
|
||||
collect_active_jobs_from_all_queries(tcx, false).expect(
|
||||
"failed to collect active queries in deadlock handler",
|
||||
// We need the complete map to ensure we find a cycle to
|
||||
// break.
|
||||
collect_active_jobs_from_all_queries(
|
||||
tcx,
|
||||
CollectActiveJobsKind::FullNoContention,
|
||||
)
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user