Avoid an unnecessary clone for copy_cgu_workproduct_to_incr_comp_cache_dir calls
This commit is contained in:
parent
02162c4163
commit
065e202b56
@ -69,7 +69,7 @@ fn emit_module(
|
|||||||
rustc_incremental::copy_cgu_workproduct_to_incr_comp_cache_dir(
|
rustc_incremental::copy_cgu_workproduct_to_incr_comp_cache_dir(
|
||||||
tcx.sess,
|
tcx.sess,
|
||||||
&name,
|
&name,
|
||||||
&Some(tmp_file.clone()),
|
Some(&tmp_file),
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -494,10 +494,10 @@ fn copy_all_cgu_workproducts_to_incr_comp_cache_dir(
|
|||||||
let _timer = sess.timer("copy_all_cgu_workproducts_to_incr_comp_cache_dir");
|
let _timer = sess.timer("copy_all_cgu_workproducts_to_incr_comp_cache_dir");
|
||||||
|
|
||||||
for module in compiled_modules.modules.iter().filter(|m| m.kind == ModuleKind::Regular) {
|
for module in compiled_modules.modules.iter().filter(|m| m.kind == ModuleKind::Regular) {
|
||||||
let path = module.object.as_ref().cloned();
|
let path = module.object.as_deref();
|
||||||
|
|
||||||
if let Some((id, product)) =
|
if let Some((id, product)) =
|
||||||
copy_cgu_workproduct_to_incr_comp_cache_dir(sess, &module.name, &path)
|
copy_cgu_workproduct_to_incr_comp_cache_dir(sess, &module.name, path)
|
||||||
{
|
{
|
||||||
work_products.insert(id, product);
|
work_products.insert(id, product);
|
||||||
}
|
}
|
||||||
|
@ -7,13 +7,13 @@
|
|||||||
use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
|
use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
|
||||||
use rustc_session::Session;
|
use rustc_session::Session;
|
||||||
use std::fs as std_fs;
|
use std::fs as std_fs;
|
||||||
use std::path::PathBuf;
|
use std::path::Path;
|
||||||
|
|
||||||
/// Copies a CGU work product to the incremental compilation directory, so next compilation can find and reuse it.
|
/// Copies a CGU work product to the incremental compilation directory, so next compilation can find and reuse it.
|
||||||
pub fn copy_cgu_workproduct_to_incr_comp_cache_dir(
|
pub fn copy_cgu_workproduct_to_incr_comp_cache_dir(
|
||||||
sess: &Session,
|
sess: &Session,
|
||||||
cgu_name: &str,
|
cgu_name: &str,
|
||||||
path: &Option<PathBuf>,
|
path: Option<&Path>,
|
||||||
) -> Option<(WorkProductId, WorkProduct)> {
|
) -> Option<(WorkProductId, WorkProduct)> {
|
||||||
debug!("copy_cgu_workproduct_to_incr_comp_cache_dir({:?},{:?})", cgu_name, path);
|
debug!("copy_cgu_workproduct_to_incr_comp_cache_dir({:?},{:?})", cgu_name, path);
|
||||||
sess.opts.incremental.as_ref()?;
|
sess.opts.incremental.as_ref()?;
|
||||||
|
Loading…
Reference in New Issue
Block a user