diff options
| author | bors <bors@rust-lang.org> | 2020-11-12 15:34:09 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-11-12 15:34:09 +0000 |
| commit | 9722952f0bed5815cb22cb4878be09fb39f92804 (patch) | |
| tree | 270b703ec4edbb5a4c94f9edaac23b714d7a0512 /src/test | |
| parent | 7f5a42b073dc2bee2aa625052eb066ee07072048 (diff) | |
| parent | dac57e67d6116bcad81f905b8e92be3e9d8e4d23 (diff) | |
Auto merge of #76256 - tgnottingham:issue-74890, r=nikomatsakis
incr-comp: hash and serialize span end line/column Hash both the length and the end location (line/column) of a span. If we hash only the length, for example, then two otherwise equal spans with different end locations will have the same hash. This can cause a problem during incremental compilation wherein a previous result for a query that depends on the end location of a span will be incorrectly reused when the end location of the span it depends on has changed. A similar analysis applies if some query depends specifically on the length of the span, but we only hash the end location. So hash both. Fix #46744, fix #59954, fix #63161, fix #73640, fix #73967, fix #74890, fix #75900 --- See #74890 for a more in-depth analysis. I haven't thought about what other problems this root cause could be responsible for. Please let me know if anything springs to mind. I believe the issue has existed since the inception of incremental compilation.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/run-make/incr-prev-body-beyond-eof/Makefile | 19 | ||||
| -rw-r--r-- | src/test/run-make/incr-prev-body-beyond-eof/a.rs | 16 | ||||
| -rw-r--r-- | src/test/run-make/incr-prev-body-beyond-eof/b.rs | 12 | ||||
| -rw-r--r-- | src/test/run-make/issue-36710/Makefile | 1 |
4 files changed, 48 insertions, 0 deletions
diff --git a/src/test/run-make/incr-prev-body-beyond-eof/Makefile b/src/test/run-make/incr-prev-body-beyond-eof/Makefile new file mode 100644 index 00000000000..49a7ee5f900 --- /dev/null +++ b/src/test/run-make/incr-prev-body-beyond-eof/Makefile @@ -0,0 +1,19 @@ +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) + +# Tests that we don't ICE during incremental compilation after modifying a +# function span such that its previous end line exceeds the number of lines +# in the new file, but its start line/column and length remain the same. + +SRC=$(TMPDIR)/src +INCR=$(TMPDIR)/incr + +all: + mkdir $(SRC) + mkdir $(INCR) + cp a.rs $(SRC)/main.rs + $(RUSTC) -C incremental=$(INCR) $(SRC)/main.rs + cp b.rs $(SRC)/main.rs + $(RUSTC) -C incremental=$(INCR) $(SRC)/main.rs diff --git a/src/test/run-make/incr-prev-body-beyond-eof/a.rs b/src/test/run-make/incr-prev-body-beyond-eof/a.rs new file mode 100644 index 00000000000..ca70fb56334 --- /dev/null +++ b/src/test/run-make/incr-prev-body-beyond-eof/a.rs @@ -0,0 +1,16 @@ +fn main() { + // foo must be used. + foo(); +} + +// For this test to operate correctly, foo's body must start on exactly the same +// line and column and have the exact same length in bytes in a.rs and b.rs. In +// a.rs, the body must end on a line number which does not exist in b.rs. +// Basically, avoid modifying this file, including adding or removing whitespace! +fn foo() { + assert_eq!(1, 1); + + + + +} diff --git a/src/test/run-make/incr-prev-body-beyond-eof/b.rs b/src/test/run-make/incr-prev-body-beyond-eof/b.rs new file mode 100644 index 00000000000..a272e44a632 --- /dev/null +++ b/src/test/run-make/incr-prev-body-beyond-eof/b.rs @@ -0,0 +1,12 @@ +fn main() { + // foo must be used. + foo(); +} + +// For this test to operate correctly, foo's body must start on exactly the same +// line and column and have the exact same length in bytes in a.rs and b.rs. In +// a.rs, the body must end on a line number which does not exist in b.rs. +// Basically, avoid modifying this file, including adding or removing whitespace! +fn foo() { + assert_eq!(1, 1);//// +} diff --git a/src/test/run-make/issue-36710/Makefile b/src/test/run-make/issue-36710/Makefile index b7bf366c918..b0e8451ff5d 100644 --- a/src/test/run-make/issue-36710/Makefile +++ b/src/test/run-make/issue-36710/Makefile @@ -1,5 +1,6 @@ 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) all: foo |
