diff options
| author | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2024-06-22 09:14:26 +0000 |
|---|---|---|
| committer | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2024-06-22 17:06:47 +0000 |
| commit | 7332e79d5fca8ccc48fcb1668f95f6f1bd7ce7c9 (patch) | |
| tree | 386a0b5b2d2320fab86d2e1d6abee4777d336bc1 | |
| parent | 391bdb3c12bf7739e58a9877b42ea05beb7331f3 (diff) | |
| download | rust-7332e79d5fca8ccc48fcb1668f95f6f1bd7ce7c9.tar.gz rust-7332e79d5fca8ccc48fcb1668f95f6f1bd7ce7c9.zip | |
Inline write_dep_info query
| -rw-r--r-- | compiler/rustc_driver_impl/src/lib.rs | 10 | ||||
| -rw-r--r-- | compiler/rustc_interface/src/lib.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_interface/src/passes.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_interface/src/queries.rs | 7 |
4 files changed, 9 insertions, 12 deletions
diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs index 5ffa3a6099c..da358baa21f 100644 --- a/compiler/rustc_driver_impl/src/lib.rs +++ b/compiler/rustc_driver_impl/src/lib.rs @@ -30,7 +30,7 @@ use rustc_errors::{ }; use rustc_feature::find_gated_cfg; use rustc_interface::util::{self, get_codegen_backend}; -use rustc_interface::{interface, Queries}; +use rustc_interface::{interface, passes, Queries}; use rustc_lint::unerased_lint_store; use rustc_metadata::creader::MetadataLoader; use rustc_metadata::locator; @@ -399,7 +399,9 @@ fn run_compiler( Ok(()) })?; - queries.write_dep_info()?; + queries.global_ctxt()?.enter(|tcx| { + passes::write_dep_info(tcx); + }); } else { let krate = queries.parse()?; pretty::print( @@ -427,7 +429,9 @@ fn run_compiler( return early_exit(); } - queries.write_dep_info()?; + queries.global_ctxt()?.enter(|tcx| { + passes::write_dep_info(tcx); + }); if sess.opts.output_types.contains_key(&OutputType::DepInfo) && sess.opts.output_types.len() == 1 diff --git a/compiler/rustc_interface/src/lib.rs b/compiler/rustc_interface/src/lib.rs index 0c3d4e19ef8..38f64ebb04e 100644 --- a/compiler/rustc_interface/src/lib.rs +++ b/compiler/rustc_interface/src/lib.rs @@ -8,7 +8,7 @@ mod callbacks; mod errors; pub mod interface; -mod passes; +pub mod passes; mod proc_macro_decls; mod queries; pub mod util; diff --git a/compiler/rustc_interface/src/passes.rs b/compiler/rustc_interface/src/passes.rs index ef0138b4ef1..2951f50b1f5 100644 --- a/compiler/rustc_interface/src/passes.rs +++ b/compiler/rustc_interface/src/passes.rs @@ -562,7 +562,7 @@ fn resolver_for_lowering_raw<'tcx>( (tcx.arena.alloc(Steal::new((untracked_resolver_for_lowering, Lrc::new(krate)))), resolutions) } -pub(crate) fn write_dep_info(tcx: TyCtxt<'_>) { +pub fn write_dep_info(tcx: TyCtxt<'_>) { // Make sure name resolution and macro expansion is run for // the side-effect of providing a complete set of all // accessed files and env vars. diff --git a/compiler/rustc_interface/src/queries.rs b/compiler/rustc_interface/src/queries.rs index 68710df8516..cfd4304e893 100644 --- a/compiler/rustc_interface/src/queries.rs +++ b/compiler/rustc_interface/src/queries.rs @@ -117,13 +117,6 @@ impl<'tcx> Queries<'tcx> { }) } - pub fn write_dep_info(&'tcx self) -> Result<()> { - self.global_ctxt()?.enter(|tcx| { - passes::write_dep_info(tcx); - }); - Ok(()) - } - pub fn codegen_and_build_linker(&'tcx self) -> Result<Linker> { self.global_ctxt()?.enter(|tcx| { let ongoing_codegen = passes::start_codegen(&*self.compiler.codegen_backend, tcx)?; |
