diff options
| author | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2025-01-22 14:00:36 +0000 |
|---|---|---|
| committer | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2025-01-23 09:38:58 +0000 |
| commit | 974db1a6e444e2b053f49a8d3242db335669acef (patch) | |
| tree | 77c12157528b8c9b4ae0115dc090593da64a6bcb /compiler/rustc_driver_impl/src | |
| parent | 4f9b9a43c1c64781a19edeb58b4022df9ac0aafb (diff) | |
| download | rust-974db1a6e444e2b053f49a8d3242db335669acef.tar.gz rust-974db1a6e444e2b053f49a8d3242db335669acef.zip | |
Remove set_make_codegen_backend and set_file_loader
They can both be set inside the config callback too.
Diffstat (limited to 'compiler/rustc_driver_impl/src')
| -rw-r--r-- | compiler/rustc_driver_impl/src/lib.rs | 50 |
1 files changed, 5 insertions, 45 deletions
diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs index e8bfe429585..c0c4debcda3 100644 --- a/compiler/rustc_driver_impl/src/lib.rs +++ b/compiler/rustc_driver_impl/src/lib.rs @@ -60,7 +60,6 @@ use rustc_session::lint::{Lint, LintId}; use rustc_session::output::collect_crate_types; use rustc_session::{EarlyDiagCtxt, Session, config, filesearch}; use rustc_span::FileName; -use rustc_span::source_map::FileLoader; use rustc_target::json::ToJson; use rustc_target::spec::{Target, TargetTuple}; use time::OffsetDateTime; @@ -211,59 +210,20 @@ pub fn diagnostics_registry() -> Registry { pub struct RunCompiler<'a> { at_args: &'a [String], callbacks: &'a mut (dyn Callbacks + Send), - file_loader: Option<Box<dyn FileLoader + Send + Sync>>, - make_codegen_backend: - Option<Box<dyn FnOnce(&config::Options) -> Box<dyn CodegenBackend> + Send>>, } impl<'a> RunCompiler<'a> { pub fn new(at_args: &'a [String], callbacks: &'a mut (dyn Callbacks + Send)) -> Self { - Self { at_args, callbacks, file_loader: None, make_codegen_backend: None } - } - - /// Set a custom codegen backend. - /// - /// Has no uses within this repository, but is used by bjorn3 for "the - /// hotswapping branch of cg_clif" for "setting the codegen backend from a - /// custom driver where the custom codegen backend has arbitrary data." - /// (See #102759.) - pub fn set_make_codegen_backend( - &mut self, - make_codegen_backend: Option< - Box<dyn FnOnce(&config::Options) -> Box<dyn CodegenBackend> + Send>, - >, - ) -> &mut Self { - self.make_codegen_backend = make_codegen_backend; - self - } - - /// Load files from sources other than the file system. - /// - /// Has no uses within this repository, but may be used in the future by - /// bjorn3 for "hooking rust-analyzer's VFS into rustc at some point for - /// running rustc without having to save". (See #102759.) - pub fn set_file_loader( - &mut self, - file_loader: Option<Box<dyn FileLoader + Send + Sync>>, - ) -> &mut Self { - self.file_loader = file_loader; - self + Self { at_args, callbacks } } /// Parse args and run the compiler. pub fn run(self) { - run_compiler(self.at_args, self.callbacks, self.file_loader, self.make_codegen_backend); + run_compiler(self.at_args, self.callbacks); } } -fn run_compiler( - at_args: &[String], - callbacks: &mut (dyn Callbacks + Send), - file_loader: Option<Box<dyn FileLoader + Send + Sync>>, - make_codegen_backend: Option< - Box<dyn FnOnce(&config::Options) -> Box<dyn CodegenBackend> + Send>, - >, -) { +fn run_compiler(at_args: &[String], callbacks: &mut (dyn Callbacks + Send)) { let mut default_early_dcx = EarlyDiagCtxt::new(ErrorOutputType::default()); // Throw away the first argument, the name of the binary. @@ -300,14 +260,14 @@ fn run_compiler( output_file: ofile, output_dir: odir, ice_file, - file_loader, + file_loader: None, locale_resources: DEFAULT_LOCALE_RESOURCES.to_vec(), lint_caps: Default::default(), psess_created: None, hash_untracked_state: None, register_lints: None, override_queries: None, - make_codegen_backend, + make_codegen_backend: None, registry: diagnostics_registry(), using_internal_features: &USING_INTERNAL_FEATURES, expanded_args: args, |
