Move finalize_session_directory call out of cg_llvm
This causes it to be called even when passing `-Zno-link`, when linking fails or when neither `--emit link` nor `--emit metadata` is used.
This commit is contained in:
parent
69f45cd965
commit
f141acf067
4 changed files with 8 additions and 11 deletions
|
@ -3,6 +3,7 @@ use crate::passes::{self, BoxedResolver, QueryContext};
|
|||
|
||||
use rustc_ast as ast;
|
||||
use rustc_codegen_ssa::traits::CodegenBackend;
|
||||
use rustc_data_structures::svh::Svh;
|
||||
use rustc_data_structures::sync::{Lrc, OnceCell, WorkerLocal};
|
||||
use rustc_errors::ErrorReported;
|
||||
use rustc_hir::def_id::LOCAL_CRATE;
|
||||
|
@ -331,6 +332,7 @@ impl<'tcx> Queries<'tcx> {
|
|||
pub fn linker(&'tcx self) -> Result<Linker> {
|
||||
let dep_graph = self.dep_graph()?;
|
||||
let prepare_outputs = self.prepare_outputs()?;
|
||||
let crate_hash = self.global_ctxt()?.peek_mut().enter(|tcx| tcx.crate_hash(LOCAL_CRATE));
|
||||
let ongoing_codegen = self.ongoing_codegen()?;
|
||||
|
||||
let sess = self.session().clone();
|
||||
|
@ -340,6 +342,7 @@ impl<'tcx> Queries<'tcx> {
|
|||
sess,
|
||||
dep_graph: dep_graph.peek().clone(),
|
||||
prepare_outputs: prepare_outputs.take(),
|
||||
crate_hash,
|
||||
ongoing_codegen: ongoing_codegen.take(),
|
||||
codegen_backend,
|
||||
})
|
||||
|
@ -350,6 +353,7 @@ pub struct Linker {
|
|||
sess: Lrc<Session>,
|
||||
dep_graph: DepGraph,
|
||||
prepare_outputs: OutputFilenames,
|
||||
crate_hash: Svh,
|
||||
ongoing_codegen: Box<dyn Any>,
|
||||
codegen_backend: Lrc<Box<dyn CodegenBackend>>,
|
||||
}
|
||||
|
@ -370,6 +374,10 @@ impl Linker {
|
|||
let prof = self.sess.prof.clone();
|
||||
prof.generic_activity("drop_dep_graph").run(move || drop(dep_graph));
|
||||
|
||||
// Now that we won't touch anything in the incremental compilation directory
|
||||
// any more, we can finalize it (which involves renaming it)
|
||||
rustc_incremental::finalize_session_directory(&self.sess, self.crate_hash);
|
||||
|
||||
if !self
|
||||
.sess
|
||||
.opts
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue