Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include (potentially remapped) working dir in crate hash
Fixes #85019 A `SourceFile` created during compilation may have a relative path (e.g. if rustc itself is invoked with a relative path). When we write out crate metadata, we convert all relative paths to absolute paths using the current working direction. However, the working directory is not included in the crate hash. This means that the crate metadata can change while the crate hash remains the same. Among other problems, this can cause a fingerprint mismatch ICE, since incremental compilation uses the crate metadata hash to determine if a foreign query is green. This commit moves the field holding the working directory from `Session` to `Options`, including it as part of the crate hash.
- Loading branch information
Showing
10 changed files
with
61 additions
and
18 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,25 @@ | ||
include ../../run-make-fulldeps/tools.mk | ||
|
||
INCR=$(TMPDIR)/incr | ||
FIRST_SRC=$(TMPDIR)/first_src | ||
SECOND_SRC=$(TMPDIR)/second_src | ||
|
||
# Tests that we don't get an ICE when the working directory | ||
# (but not the build directory!) changes between compilation | ||
# sessions | ||
|
||
all: | ||
mkdir $(INCR) | ||
# Build from 'FIRST_SRC' | ||
mkdir $(FIRST_SRC) | ||
cp my_lib.rs $(FIRST_SRC)/my_lib.rs | ||
cp main.rs $(FIRST_SRC)/main.rs | ||
cd $(FIRST_SRC) && \ | ||
$(RUSTC) -C incremental=$(INCR) --crate-type lib my_lib.rs && \ | ||
$(RUSTC) -C incremental=$(INCR) --extern my_lib=$(TMPDIR)/libmy_lib.rlib main.rs | ||
# Build from 'SECOND_SRC', keeping the output directory and incremental directory | ||
# the same | ||
mv $(FIRST_SRC) $(SECOND_SRC) | ||
cd $(SECOND_SRC) && \ | ||
$(RUSTC) -C incremental=$(INCR) --crate-type lib my_lib.rs && \ | ||
$(RUSTC) -C incremental=$(INCR) --extern my_lib=$(TMPDIR)/libmy_lib.rlib main.rs |
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,5 @@ | ||
extern crate my_lib; | ||
|
||
fn main() { | ||
my_lib::my_fn("hi"); | ||
} |
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 @@ | ||
pub fn my_fn<T: Copy>(_val: T) {} |