Don't copy bytecode files into the incr. comp. cache.
It's no longer necessary now that bitcode is embedded into object files. This change meant that `WorkProductFileKind::Bytecode` is no longer necessary, which means that type is no longer necessary, which allowed several places in the code to become simpler.
This commit is contained in:
parent
fd61d06772
commit
d4e5e1bcff
7 changed files with 19 additions and 45 deletions
|
|
@ -134,7 +134,7 @@ pub fn load_dep_graph(sess: &Session) -> DepGraphFuture {
|
|||
|
||||
for swp in work_products {
|
||||
let mut all_files_exist = true;
|
||||
for &(_, ref file_name) in swp.work_product.saved_files.iter() {
|
||||
for file_name in swp.work_product.saved_files.iter() {
|
||||
let path = in_incr_comp_dir_sess(sess, file_name);
|
||||
if !path.exists() {
|
||||
all_files_exist = false;
|
||||
|
|
|
|||
|
|
@ -74,9 +74,9 @@ pub fn save_work_product_index(
|
|||
if !new_work_products.contains_key(id) {
|
||||
work_product::delete_workproduct_files(sess, wp);
|
||||
debug_assert!(
|
||||
wp.saved_files.iter().all(|&(_, ref file_name)| {
|
||||
!in_incr_comp_dir_sess(sess, file_name).exists()
|
||||
})
|
||||
wp.saved_files
|
||||
.iter()
|
||||
.all(|file_name| { !in_incr_comp_dir_sess(sess, file_name).exists() })
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -85,7 +85,7 @@ pub fn save_work_product_index(
|
|||
debug_assert!({
|
||||
new_work_products
|
||||
.iter()
|
||||
.flat_map(|(_, wp)| wp.saved_files.iter().map(|&(_, ref name)| name))
|
||||
.flat_map(|(_, wp)| wp.saved_files.iter())
|
||||
.map(|name| in_incr_comp_dir_sess(sess, name))
|
||||
.all(|path| path.exists())
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use crate::persist::fs::*;
|
||||
use rustc_fs_util::link_or_copy;
|
||||
use rustc_middle::dep_graph::{WorkProduct, WorkProductFileKind, WorkProductId};
|
||||
use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
|
||||
use rustc_session::Session;
|
||||
use std::fs as std_fs;
|
||||
use std::path::PathBuf;
|
||||
|
|
@ -10,22 +10,18 @@ use std::path::PathBuf;
|
|||
pub fn copy_cgu_workproducts_to_incr_comp_cache_dir(
|
||||
sess: &Session,
|
||||
cgu_name: &str,
|
||||
files: &[(WorkProductFileKind, PathBuf)],
|
||||
files: &[PathBuf],
|
||||
) -> Option<(WorkProductId, WorkProduct)> {
|
||||
debug!("copy_cgu_workproducts_to_incr_comp_cache_dir({:?},{:?})", cgu_name, files);
|
||||
sess.opts.incremental.as_ref()?;
|
||||
|
||||
let saved_files = files
|
||||
.iter()
|
||||
.map(|&(kind, ref path)| {
|
||||
let extension = match kind {
|
||||
WorkProductFileKind::Object => "o",
|
||||
WorkProductFileKind::Bytecode => "bc",
|
||||
};
|
||||
let file_name = format!("{}.{}", cgu_name, extension);
|
||||
.map(|path| {
|
||||
let file_name = format!("{}.o", cgu_name);
|
||||
let path_in_incr_dir = in_incr_comp_dir_sess(sess, &file_name);
|
||||
match link_or_copy(path, &path_in_incr_dir) {
|
||||
Ok(_) => Some((kind, file_name)),
|
||||
Ok(_) => Some(file_name),
|
||||
Err(err) => {
|
||||
sess.warn(&format!(
|
||||
"error copying object file `{}` \
|
||||
|
|
@ -47,7 +43,7 @@ pub fn copy_cgu_workproducts_to_incr_comp_cache_dir(
|
|||
}
|
||||
|
||||
pub fn delete_workproduct_files(sess: &Session, work_product: &WorkProduct) {
|
||||
for &(_, ref file_name) in &work_product.saved_files {
|
||||
for file_name in &work_product.saved_files {
|
||||
let path = in_incr_comp_dir_sess(sess, file_name);
|
||||
match std_fs::remove_file(&path) {
|
||||
Ok(()) => {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue