about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc/src/back/write.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-04-07 10:46:50 +0000
committerbors <bors@rust-lang.org>2024-04-07 10:46:50 +0000
commitfc1a4c5cc9308c4b5980c64a73fd344a59c10601 (patch)
tree5c57656ec61dea95a81c63b10fa7dc47d0e542fe /compiler/rustc_codegen_gcc/src/back/write.rs
parent8f2c255ae03c524323a52d7003ac176beaa3ea74 (diff)
parent691e953da6aa5dc21d999fb81f0f13ce1816828f (diff)
downloadrust-fc1a4c5cc9308c4b5980c64a73fd344a59c10601.tar.gz
rust-fc1a4c5cc9308c4b5980c64a73fd344a59c10601.zip
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
Diffstat (limited to 'compiler/rustc_codegen_gcc/src/back/write.rs')
-rw-r--r--compiler/rustc_codegen_gcc/src/back/write.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_gcc/src/back/write.rs b/compiler/rustc_codegen_gcc/src/back/write.rs
index 76a619a1af7..3ea5be1ee56 100644
--- a/compiler/rustc_codegen_gcc/src/back/write.rs
+++ b/compiler/rustc_codegen_gcc/src/back/write.rs
@@ -158,6 +158,8 @@ pub(crate) unsafe fn codegen(
         config.emit_obj != EmitObj::None,
         cgcx.target_can_use_split_dwarf && cgcx.split_debuginfo == SplitDebuginfo::Unpacked,
         config.emit_bc,
+        config.emit_asm,
+        config.emit_ir,
         &cgcx.output_filenames,
     ))
 }