diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2023-01-19 14:12:29 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2023-01-23 10:35:21 +0000 |
| commit | 261bbd7dbaaeb3a4f3d25610b6f93aac874bd910 (patch) | |
| tree | e63e6568484e1f4b160292ea52bff8a186191599 /compiler/rustc_driver/src | |
| parent | 3ddb54f1554c9f1eccc8d0e9315a78d2178ad5aa (diff) | |
| download | rust-261bbd7dbaaeb3a4f3d25610b6f93aac874bd910.tar.gz rust-261bbd7dbaaeb3a4f3d25610b6f93aac874bd910.zip | |
Store the gctxt instead of fetching it twice.
Diffstat (limited to 'compiler/rustc_driver/src')
| -rw-r--r-- | compiler/rustc_driver/src/lib.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler/rustc_driver/src/lib.rs b/compiler/rustc_driver/src/lib.rs index 862931da009..ccefd6adaf1 100644 --- a/compiler/rustc_driver/src/lib.rs +++ b/compiler/rustc_driver/src/lib.rs @@ -327,12 +327,14 @@ fn run_compiler( } } - queries.global_ctxt()?; + let mut gctxt = queries.global_ctxt()?; if callbacks.after_expansion(compiler, queries) == Compilation::Stop { return early_exit(); } - queries.global_ctxt()?.enter(|tcx| tcx.output_filenames(())); + // Make sure the `output_filenames` query is run for its side + // effects of writing the dep-info and reporting errors. + gctxt.enter(|tcx| tcx.output_filenames(())); if sess.opts.output_types.contains_key(&OutputType::DepInfo) && sess.opts.output_types.len() == 1 @@ -344,7 +346,7 @@ fn run_compiler( return early_exit(); } - queries.global_ctxt()?.enter(|tcx| { + gctxt.enter(|tcx| { let result = tcx.analysis(()); if sess.opts.unstable_opts.save_analysis { let crate_name = tcx.crate_name(LOCAL_CRATE); @@ -361,6 +363,8 @@ fn run_compiler( result })?; + drop(gctxt); + if callbacks.after_analysis(compiler, queries) == Compilation::Stop { return early_exit(); } |
