Skip to content

Commit 065e202

Browse files
committed
Avoid an unnecessary clone for copy_cgu_workproduct_to_incr_comp_cache_dir calls
1 parent 02162c4 commit 065e202

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

compiler/rustc_codegen_cranelift/src/driver/aot.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ fn emit_module(
6969
rustc_incremental::copy_cgu_workproduct_to_incr_comp_cache_dir(
7070
tcx.sess,
7171
&name,
72-
&Some(tmp_file.clone()),
72+
Some(&tmp_file),
7373
)
7474
};
7575

compiler/rustc_codegen_ssa/src/back/write.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -494,10 +494,10 @@ fn copy_all_cgu_workproducts_to_incr_comp_cache_dir(
494494
let _timer = sess.timer("copy_all_cgu_workproducts_to_incr_comp_cache_dir");
495495

496496
for module in compiled_modules.modules.iter().filter(|m| m.kind == ModuleKind::Regular) {
497-
let path = module.object.as_ref().cloned();
497+
let path = module.object.as_deref();
498498

499499
if let Some((id, product)) =
500-
copy_cgu_workproduct_to_incr_comp_cache_dir(sess, &module.name, &path)
500+
copy_cgu_workproduct_to_incr_comp_cache_dir(sess, &module.name, path)
501501
{
502502
work_products.insert(id, product);
503503
}

compiler/rustc_incremental/src/persist/work_product.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ use rustc_fs_util::link_or_copy;
77
use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
88
use rustc_session::Session;
99
use std::fs as std_fs;
10-
use std::path::PathBuf;
10+
use std::path::Path;
1111

1212
/// Copies a CGU work product to the incremental compilation directory, so next compilation can find and reuse it.
1313
pub fn copy_cgu_workproduct_to_incr_comp_cache_dir(
1414
sess: &Session,
1515
cgu_name: &str,
16-
path: &Option<PathBuf>,
16+
path: Option<&Path>,
1717
) -> Option<(WorkProductId, WorkProduct)> {
1818
debug!("copy_cgu_workproduct_to_incr_comp_cache_dir({:?},{:?})", cgu_name, path);
1919
sess.opts.incremental.as_ref()?;

0 commit comments

Comments
 (0)