forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#123221 - pacak:cache_emit, r=<try>
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 rust-lang#89149 Fixes rust-lang#88829 Related: https://internals.rust-lang.org/t/interaction-between-incremental-compilation-and-emit/20551
- Loading branch information
Showing
9 changed files
with
127 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#![crate_name = "foo"] | ||
|
||
#[inline(never)] | ||
pub fn add(a: u32, b: u32) -> u32 { | ||
a + b | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// rustc should be able to emit required files (asm, llvm-*, etc) during incremental | ||
// compilation on the first pass by running the code gen as well as on subsequent runs - | ||
// extracting them from the cache | ||
// | ||
// Fixes: rust-lang/rust#89149 | ||
// Fixes: rust-lang/rust#88829 | ||
// Also see discussion at | ||
// <https://internals.rust-lang.org/t/interaction-between-incremental-compilation-and-emit/20551> | ||
|
||
extern crate run_make_support; | ||
|
||
use run_make_support::{rustc, tmp_dir}; | ||
|
||
fn main() { | ||
let inc_dir = tmp_dir(); | ||
|
||
for _ in 0..=1 { | ||
rustc() | ||
.input("lib.rs") | ||
.crate_type("lib") | ||
.emit("obj,asm,dep-info,link,mir,llvm-ir,llvm-bc") | ||
.incremental(&inc_dir) | ||
.run(); | ||
} | ||
} |