2 pub use self::plumbing
::*;
5 #[cfg(parallel_compiler)]
6 pub use self::job
::deadlock
;
7 pub use self::job
::{QueryInfo, QueryJob, QueryJobId, QueryJobInfo}
;
10 pub use self::caches
::{CacheSelector, DefaultCacheSelector, QueryCache}
;
13 pub use self::config
::{QueryAccessors, QueryConfig, QueryDescription}
;
15 use crate::dep_graph
::{DepContext, DepGraph}
;
17 use rustc_data_structures
::fx
::FxHashMap
;
18 use rustc_data_structures
::stable_hasher
::HashStable
;
19 use rustc_data_structures
::sync
::Lock
;
20 use rustc_data_structures
::thin_vec
::ThinVec
;
21 use rustc_errors
::Diagnostic
;
22 use rustc_span
::def_id
::DefId
;
24 pub trait QueryContext
: DepContext
{
25 type Query
: Clone
+ HashStable
<Self::StableHashingContext
>;
27 fn incremental_verify_ich(&self) -> bool
;
28 fn verbose(&self) -> bool
;
30 /// Get string representation from DefPath.
31 fn def_path_str(&self, def_id
: DefId
) -> String
;
33 /// Access the DepGraph.
34 fn dep_graph(&self) -> &DepGraph
<Self::DepKind
>;
36 /// Get the query information from the TLS context.
37 fn current_query_job(&self) -> Option
<QueryJobId
<Self::DepKind
>>;
39 fn try_collect_active_jobs(
41 ) -> Option
<FxHashMap
<QueryJobId
<Self::DepKind
>, QueryJobInfo
<Self>>>;
43 /// Executes a job by changing the `ImplicitCtxt` to point to the
44 /// new query job while it executes. It returns the diagnostics
45 /// captured during execution and the actual result.
48 token
: QueryJobId
<Self::DepKind
>,
49 diagnostics
: Option
<&Lock
<ThinVec
<Diagnostic
>>>,
50 compute
: impl FnOnce(Self) -> R
,