Auto merge of #123221 - pacak:cache_emit, r=fmease,jieyouxu
Save/restore more items in cache with incremental compilation Right now they don't play very well together, consider a simple example: ``` $ export RUSTFLAGS="--emit asm" $ cargo new --lib foo Created library `foo` package $ cargo build -q $ touch src/lib.rs $ cargo build error: could not copy "/path/to/foo/target/debug/deps/foo-e307cc7fa7b6d64f.4qbzn9k8mosu50a5.rcgu.s" to "/path/to/foo/target/debug/deps/foo-e307cc7fa7b6d64f.s": No such file or directory (os error 2) ``` Touch triggers the rebuild, incremental compilation detects no changes (yay) and everything explodes while trying to copy files were they should go. This pull request fixes it by copying and restoring more files in the incremental compilation cache Fixes https://github.com/rust-lang/rust/issues/89149 Fixes https://github.com/rust-lang/rust/issues/88829 Related: https://internals.rust-lang.org/t/interaction-between-incremental-compilation-and-emit/20551
This commit is contained in:
commit
5d765b8cc1
@ -341,6 +341,8 @@ fn emit_cgu(
|
||||
object: Some(global_asm_object_file),
|
||||
dwarf_object: None,
|
||||
bytecode: None,
|
||||
assembly: None,
|
||||
llvm_ir: None,
|
||||
}),
|
||||
existing_work_product: None,
|
||||
})
|
||||
@ -378,7 +380,15 @@ fn emit_module(
|
||||
|
||||
prof.artifact_size("object_file", &*name, file.metadata().unwrap().len());
|
||||
|
||||
Ok(CompiledModule { name, kind, object: Some(tmp_file), dwarf_object: None, bytecode: None })
|
||||
Ok(CompiledModule {
|
||||
name,
|
||||
kind,
|
||||
object: Some(tmp_file),
|
||||
dwarf_object: None,
|
||||
bytecode: None,
|
||||
assembly: None,
|
||||
llvm_ir: None,
|
||||
})
|
||||
}
|
||||
|
||||
fn reuse_workproduct_for_cgu(
|
||||
@ -426,6 +436,8 @@ fn reuse_workproduct_for_cgu(
|
||||
object: Some(obj_out_regular),
|
||||
dwarf_object: None,
|
||||
bytecode: None,
|
||||
assembly: None,
|
||||
llvm_ir: None,
|
||||
},
|
||||
module_global_asm: has_global_asm.then(|| CompiledModule {
|
||||
name: cgu.name().to_string(),
|
||||
@ -433,6 +445,8 @@ fn reuse_workproduct_for_cgu(
|
||||
object: Some(obj_out_global_asm),
|
||||
dwarf_object: None,
|
||||
bytecode: None,
|
||||
assembly: None,
|
||||
llvm_ir: None,
|
||||
}),
|
||||
existing_work_product: Some((cgu.work_product_id(), work_product)),
|
||||
})
|
||||
@ -678,6 +692,8 @@ pub(crate) fn run_aot(
|
||||
object: Some(tmp_file),
|
||||
dwarf_object: None,
|
||||
bytecode: None,
|
||||
assembly: None,
|
||||
llvm_ir: None,
|
||||
})
|
||||
} else {
|
||||
None
|
||||
|
Loading…
Reference in New Issue
Block a user