@@ -11,7 +11,10 @@ use rustc_hir::def_id::DefId;
11
11
use rustc_data_structures:: fingerprint:: Fingerprint ;
12
12
use rustc_data_structures:: fx:: FxHashMap ;
13
13
use 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 } ;
15
18
use rustc_session:: Session ;
16
19
use std:: borrow:: Cow ;
17
20
use std:: fmt:: Debug ;
@@ -34,12 +37,25 @@ pub trait QueryContext: DepContext {
34
37
/// Get string representation from DefPath.
35
38
fn def_path_str ( & self , def_id : DefId ) -> String ;
36
39
40
+ /// Access the DepGraph.
41
+ fn dep_graph ( & self ) -> & DepGraph < Self :: DepKind > ;
42
+
37
43
/// Get the query information from the TLS context.
38
44
fn read_query_job < R > ( & self , op : impl FnOnce ( Option < QueryJobId < Self :: DepKind > > ) -> R ) -> R ;
39
45
40
46
fn try_collect_active_jobs (
41
47
& self ,
42
48
) -> 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 ;
43
59
}
44
60
45
61
pub ( crate ) trait QueryAccessors < CTX : QueryContext > : QueryConfig < CTX > {
0 commit comments