Make saved_file field of WorkProduct non-optional
A WorkProduct without a saved file is useless
This commit is contained in:
parent
bbb850931f
commit
3d8e854604
@ -80,21 +80,16 @@ fn reuse_workproduct_for_cgu(
|
||||
cgu: &CodegenUnit<'_>,
|
||||
work_products: &mut FxHashMap<WorkProductId, WorkProduct>,
|
||||
) -> CompiledModule {
|
||||
let mut object = None;
|
||||
let work_product = cgu.previous_work_product(tcx);
|
||||
if let Some(saved_file) = &work_product.saved_file {
|
||||
let obj_out =
|
||||
tcx.output_filenames(()).temp_path(OutputType::Object, Some(cgu.name().as_str()));
|
||||
object = Some(obj_out.clone());
|
||||
let source_file = rustc_incremental::in_incr_comp_dir_sess(&tcx.sess, &saved_file);
|
||||
if let Err(err) = rustc_fs_util::link_or_copy(&source_file, &obj_out) {
|
||||
tcx.sess.err(&format!(
|
||||
"unable to copy {} to {}: {}",
|
||||
source_file.display(),
|
||||
obj_out.display(),
|
||||
err
|
||||
));
|
||||
}
|
||||
let obj_out = tcx.output_filenames(()).temp_path(OutputType::Object, Some(cgu.name().as_str()));
|
||||
let source_file = rustc_incremental::in_incr_comp_dir_sess(&tcx.sess, &work_product.saved_file);
|
||||
if let Err(err) = rustc_fs_util::link_or_copy(&source_file, &obj_out) {
|
||||
tcx.sess.err(&format!(
|
||||
"unable to copy {} to {}: {}",
|
||||
source_file.display(),
|
||||
obj_out.display(),
|
||||
err
|
||||
));
|
||||
}
|
||||
|
||||
work_products.insert(cgu.work_product_id(), work_product);
|
||||
@ -102,7 +97,7 @@ fn reuse_workproduct_for_cgu(
|
||||
CompiledModule {
|
||||
name: cgu.name().to_string(),
|
||||
kind: ModuleKind::Regular,
|
||||
object,
|
||||
object: Some(obj_out),
|
||||
dwarf_object: None,
|
||||
bytecode: None,
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user