forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#83132 - Aaron1011:fix/incr-cache-dummy, r=e…
…stebank Don't encode file information for span with a dummy location Fixes rust-lang#83112 The location information for a dummy span isn't real, so don't encode it. This brings the incr comp cache code into line with the Span `StableHash` impl, which doesn't hash the location information for dummy spans. Previously, we would attempt to load the 'original' file from a dummy span - if the file id changed (e.g. due to being moved on disk), we would get an ICE, since the Span was still valid due to its hash being unchanged.
- Loading branch information
Showing
3 changed files
with
29 additions
and
3 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
25 changes: 25 additions & 0 deletions
25
src/test/run-make/issue-83112-incr-test-moved-file/Makefile
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 | ||
|
||
# FIXME https://github.com/rust-lang/rust/issues/78911 | ||
# ignore-32bit wrong/no cross compiler and sometimes we pass wrong gcc args (-m64) | ||
|
||
# Regression test for issue #83112 | ||
# The generated test harness code contains spans with a dummy location, | ||
# but a non-dummy SyntaxContext. Previously, the incremental cache was encoding | ||
# these spans as a full span (with a source file index), instead of skipping | ||
# the encoding of the location information. If the file gest moved, the hash | ||
# of the span will be unchanged (since it has a dummy location), so the incr | ||
# cache would end up try to load a non-existent file using the previously | ||
# enccoded source file id. | ||
|
||
SRC=$(TMPDIR)/src | ||
INCR=$(TMPDIR)/incr | ||
|
||
all: | ||
mkdir $(SRC) | ||
mkdir $(SRC)/mydir | ||
mkdir $(INCR) | ||
cp main.rs $(SRC)/main.rs | ||
$(RUSTC) --test -C incremental=$(INCR) $(SRC)/main.rs | ||
mv $(SRC)/main.rs $(SRC)/mydir/main.rs | ||
$(RUSTC) --test -C incremental=$(INCR) $(SRC)/mydir/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 @@ | ||
fn main() {} |