-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
incr-comp: hash 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
- Loading branch information
1 parent
0dce3f6
commit b71e627
Showing
4 changed files
with
66 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
-include ../../run-make-fulldeps/tools.mk | ||
|
||
# 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 |
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,14 @@ | ||
fn main() { | ||
// foo must be used. | ||
foo(); | ||
} | ||
|
||
fn foo() { | ||
// foo's span in a.rs and b.rs must be identical | ||
// with respect to start line/column and length. | ||
assert_eq!(1, 1); | ||
|
||
|
||
|
||
|
||
} |
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,10 @@ | ||
fn main() { | ||
// foo must be used. | ||
foo(); | ||
} | ||
|
||
fn foo() { | ||
// foo's span in a.rs and b.rs must be identical | ||
// with respect to start line/column and length. | ||
assert_eq!(1, 1);//// | ||
} |