diff options
| author | bjorn3 <bjorn3@users.noreply.github.com> | 2020-09-08 13:44:41 +0200 |
|---|---|---|
| committer | bjorn3 <bjorn3@users.noreply.github.com> | 2020-09-27 14:16:42 +0200 |
| commit | 71bc62b9f696ae83ef1713bd96054c92cda9f27f (patch) | |
| tree | d4229eff34beb4d3ed6539ff1f0105a2309a527f /compiler/rustc_interface/src/interface.rs | |
| parent | 956e06c6c85e918524b67503c4d65c7baf539585 (diff) | |
| download | rust-71bc62b9f696ae83ef1713bd96054c92cda9f27f.tar.gz rust-71bc62b9f696ae83ef1713bd96054c92cda9f27f.zip | |
Add option to pass a custom codegen backend from a driver
Diffstat (limited to 'compiler/rustc_interface/src/interface.rs')
| -rw-r--r-- | compiler/rustc_interface/src/interface.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_interface/src/interface.rs b/compiler/rustc_interface/src/interface.rs index 4d84462c42b..73a51ad477b 100644 --- a/compiler/rustc_interface/src/interface.rs +++ b/compiler/rustc_interface/src/interface.rs @@ -154,6 +154,10 @@ pub struct Config { pub override_queries: Option<fn(&Session, &mut ty::query::Providers, &mut ty::query::Providers)>, + /// This is a callback from the driver that is called to create a codegen backend. + pub make_codegen_backend: + Option<Box<dyn FnOnce(&config::Options) -> Box<dyn CodegenBackend> + Send>>, + /// Registry of diagnostics codes. pub registry: Registry, } @@ -167,6 +171,7 @@ pub fn create_compiler_and_run<R>(config: Config, f: impl FnOnce(&Compiler) -> R config.file_loader, config.input_path.clone(), config.lint_caps, + config.make_codegen_backend, registry.clone(), ); |
