@@ -12,6 +12,7 @@ use rustc_data_structures::OnDrop;
12
12
use rustc_data_structures:: sync:: Lrc ;
13
13
use rustc_data_structures:: fx:: { FxHashSet , FxHashMap } ;
14
14
use rustc_parse:: new_parser_from_source_str;
15
+ use rustc:: ty;
15
16
use std:: path:: PathBuf ;
16
17
use std:: result;
17
18
use std:: sync:: { Arc , Mutex } ;
@@ -38,6 +39,8 @@ pub struct Compiler {
38
39
pub ( crate ) queries : Queries ,
39
40
pub ( crate ) crate_name : Option < String > ,
40
41
pub ( crate ) register_lints : Option < Box < dyn Fn ( & Session , & mut lint:: LintStore ) + Send + Sync > > ,
42
+ pub ( crate ) override_queries :
43
+ Option < fn ( & Session , & mut ty:: query:: Providers < ' _ > , & mut ty:: query:: Providers < ' _ > ) > ,
41
44
}
42
45
43
46
impl Compiler {
@@ -131,6 +134,13 @@ pub struct Config {
131
134
/// Note that if you find a Some here you probably want to call that function in the new
132
135
/// function being registered.
133
136
pub register_lints : Option < Box < dyn Fn ( & Session , & mut lint:: LintStore ) + Send + Sync > > ,
137
+
138
+ /// This is a callback from the driver that is called just after we have populated
139
+ /// the list of queries.
140
+ ///
141
+ /// The second parameter is local providers and the third parameter is external providers.
142
+ pub override_queries :
143
+ Option < fn ( & Session , & mut ty:: query:: Providers < ' _ > , & mut ty:: query:: Providers < ' _ > ) > ,
134
144
}
135
145
136
146
pub fn run_compiler_in_existing_thread_pool < F , R > ( config : Config , f : F ) -> R
@@ -157,6 +167,7 @@ where
157
167
queries : Default :: default ( ) ,
158
168
crate_name : config. crate_name ,
159
169
register_lints : config. register_lints ,
170
+ override_queries : config. override_queries ,
160
171
} ;
161
172
162
173
let _sess_abort_error = OnDrop ( || {
0 commit comments