use rustc_codegen_ssa::traits::*;
use rustc_codegen_ssa::ModuleCodegen;
use rustc_codegen_ssa::{CodegenResults, CompiledModule};
+use rustc_data_structures::fx::FxHashMap;
use rustc_errors::{ErrorReported, FatalError, Handler};
-use rustc_middle::dep_graph::{DepGraph, WorkProduct};
+use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
use rustc_middle::middle::cstore::{EncodedMetadata, MetadataLoaderDyn};
use rustc_middle::ty::{self, TyCtxt};
use rustc_serialize::json;
&self,
ongoing_codegen: Box<dyn Any>,
sess: &Session,
- dep_graph: &DepGraph,
- ) -> Result<Box<dyn Any>, ErrorReported> {
+ ) -> Result<(Box<dyn Any>, FxHashMap<WorkProductId, WorkProduct>), ErrorReported> {
let (codegen_results, work_products) = ongoing_codegen
.downcast::<rustc_codegen_ssa::back::write::OngoingCodegen<LlvmCodegenBackend>>()
.expect("Expected LlvmCodegenBackend's OngoingCodegen, found Box<Any>")
rustc_codegen_ssa::back::write::dump_incremental_data(&codegen_results);
}
- sess.time("serialize_work_products", move || {
- rustc_incremental::save_work_product_index(sess, &dep_graph, work_products)
- });
-
- sess.compile_status()?;
-
- Ok(Box::new(codegen_results))
+ Ok((Box::new(codegen_results), work_products))
}
fn link(
use crate::ModuleCodegen;
use rustc_ast::expand::allocator::AllocatorKind;
+use rustc_data_structures::fx::FxHashMap;
use rustc_errors::ErrorReported;
-use rustc_middle::dep_graph::DepGraph;
+use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
use rustc_middle::middle::cstore::{EncodedMetadata, MetadataLoaderDyn};
use rustc_middle::ty::layout::{HasTyCtxt, TyAndLayout};
use rustc_middle::ty::query::Providers;
&self,
ongoing_codegen: Box<dyn Any>,
sess: &Session,
- dep_graph: &DepGraph,
- ) -> Result<Box<dyn Any>, ErrorReported>;
+ ) -> Result<(Box<dyn Any>, FxHashMap<WorkProductId, WorkProduct>), ErrorReported>;
/// This is called on the returned `Box<dyn Any>` from `join_codegen`
///
impl Linker {
pub fn link(self) -> Result<()> {
- let codegen_results =
- self.codegen_backend.join_codegen(self.ongoing_codegen, &self.sess, &self.dep_graph)?;
- let prof = self.sess.prof.clone();
+ let (codegen_results, work_products) =
+ self.codegen_backend.join_codegen(self.ongoing_codegen, &self.sess)?;
+
+ self.sess.compile_status()?;
+
+ let sess = &self.sess;
let dep_graph = self.dep_graph;
+ sess.time("serialize_work_products", || {
+ rustc_incremental::save_work_product_index(&sess, &dep_graph, work_products)
+ });
+
+ let prof = self.sess.prof.clone();
prof.generic_activity("drop_dep_graph").run(move || drop(dep_graph));
if !self