@@ -11,7 +11,10 @@ use rustc_hir::def_id::DefId;
1111use rustc_data_structures:: fingerprint:: Fingerprint ;
1212use rustc_data_structures:: fx:: FxHashMap ;
1313use rustc_data_structures:: stable_hasher:: HashStable ;
14- use rustc_query_system:: dep_graph:: { DepContext , DepNode } ;
14+ use rustc_data_structures:: sync:: Lock ;
15+ use rustc_data_structures:: thin_vec:: ThinVec ;
16+ use rustc_errors:: Diagnostic ;
17+ use rustc_query_system:: dep_graph:: { DepContext , DepGraph , DepNode } ;
1518use rustc_session:: Session ;
1619use std:: borrow:: Cow ;
1720use std:: fmt:: Debug ;
@@ -34,12 +37,25 @@ pub trait QueryContext: DepContext {
3437 /// Get string representation from DefPath.
3538 fn def_path_str ( & self , def_id : DefId ) -> String ;
3639
40+ /// Access the DepGraph.
41+ fn dep_graph ( & self ) -> & DepGraph < Self :: DepKind > ;
42+
3743 /// Get the query information from the TLS context.
3844 fn read_query_job < R > ( & self , op : impl FnOnce ( Option < QueryJobId < Self :: DepKind > > ) -> R ) -> R ;
3945
4046 fn try_collect_active_jobs (
4147 & self ,
4248 ) -> Option < FxHashMap < QueryJobId < Self :: DepKind > , QueryJobInfo < Self > > > ;
49+
50+ /// Executes a job by changing the `ImplicitCtxt` to point to the
51+ /// new query job while it executes. It returns the diagnostics
52+ /// captured during execution and the actual result.
53+ fn start_query < R > (
54+ & self ,
55+ token : QueryJobId < Self :: DepKind > ,
56+ diagnostics : Option < & Lock < ThinVec < Diagnostic > > > ,
57+ compute : impl FnOnce ( Self ) -> R ,
58+ ) -> R ;
4359}
4460
4561pub ( crate ) trait QueryAccessors < CTX : QueryContext > : QueryConfig < CTX > {
0 commit comments