@@ -12,6 +12,7 @@ use rustc_data_structures::OnDrop;
1212use rustc_data_structures:: sync:: Lrc ;
1313use rustc_data_structures:: fx:: { FxHashSet , FxHashMap } ;
1414use rustc_parse:: new_parser_from_source_str;
15+ use rustc:: ty;
1516use std:: path:: PathBuf ;
1617use std:: result;
1718use std:: sync:: { Arc , Mutex } ;
@@ -38,6 +39,8 @@ pub struct Compiler {
3839 pub ( crate ) queries : Queries ,
3940 pub ( crate ) crate_name : Option < String > ,
4041 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 < ' _ > ) > ,
4144}
4245
4346impl Compiler {
@@ -131,6 +134,13 @@ pub struct Config {
131134 /// Note that if you find a Some here you probably want to call that function in the new
132135 /// function being registered.
133136 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 < ' _ > ) > ,
134144}
135145
136146pub fn run_compiler_in_existing_thread_pool < F , R > ( config : Config , f : F ) -> R
@@ -157,6 +167,7 @@ where
157167 queries : Default :: default ( ) ,
158168 crate_name : config. crate_name ,
159169 register_lints : config. register_lints ,
170+ override_queries : config. override_queries ,
160171 } ;
161172
162173 let _sess_abort_error = OnDrop ( || {
0 commit comments