-
Notifications
You must be signed in to change notification settings - Fork 13k
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 #87990 - Aaron1011:moved-src-dir, r=cjgillot
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 directory. 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. cc `@ohsayan`
- Loading branch information
Showing
11 changed files
with
65 additions
and
19 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
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,28 @@ | ||
include ../../run-make-fulldeps/tools.mk | ||
|
||
INCR=$(TMPDIR)/incr | ||
FIRST_SRC=$(TMPDIR)/first_src | ||
SECOND_SRC=$(TMPDIR)/second_src | ||
|
||
# ignore-none no-std is not supported | ||
# ignore-nvptx64-nvidia-cuda FIXME: can't find crate for 'std' | ||
|
||
# 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 --target $(TARGET) && \ | ||
$(RUSTC) -C incremental=$(INCR) --extern my_lib=$(TMPDIR)/libmy_lib.rlib main.rs --target $(TARGET) | ||
# 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 --target $(TARGET) && \ | ||
$(RUSTC) -C incremental=$(INCR) --extern my_lib=$(TMPDIR)/libmy_lib.rlib main.rs --target $(TARGET) |
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) {} |