Avoid no-op unlink+link dances in incr comp
This commit is contained in:
parent
9af8985e05
commit
cae7c76d50
6 changed files with 50 additions and 21 deletions
|
@ -3,7 +3,7 @@
|
|||
//! [work products]: WorkProduct
|
||||
|
||||
use std::fs as std_fs;
|
||||
use std::path::Path;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use rustc_data_structures::unord::UnordMap;
|
||||
use rustc_fs_util::link_or_copy;
|
||||
|
@ -20,6 +20,7 @@ pub fn copy_cgu_workproduct_to_incr_comp_cache_dir(
|
|||
sess: &Session,
|
||||
cgu_name: &str,
|
||||
files: &[(&'static str, &Path)],
|
||||
known_links: &[PathBuf],
|
||||
) -> Option<(WorkProductId, WorkProduct)> {
|
||||
debug!(?cgu_name, ?files);
|
||||
sess.opts.incremental.as_ref()?;
|
||||
|
@ -28,6 +29,10 @@ pub fn copy_cgu_workproduct_to_incr_comp_cache_dir(
|
|||
for (ext, path) in files {
|
||||
let file_name = format!("{cgu_name}.{ext}");
|
||||
let path_in_incr_dir = in_incr_comp_dir_sess(sess, &file_name);
|
||||
if known_links.contains(&path_in_incr_dir) {
|
||||
let _ = saved_files.insert(ext.to_string(), file_name);
|
||||
continue;
|
||||
}
|
||||
match link_or_copy(path, &path_in_incr_dir) {
|
||||
Ok(_) => {
|
||||
let _ = saved_files.insert(ext.to_string(), file_name);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue