-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Testing strategy for rustc_save_analysis #34481
Copy link
Copy link
Closed as not planned
Labels
A-save-analysisArea: saving results of analyses such as inference and borrowck results to a file.Area: saving results of analyses such as inference and borrowck results to a file.A-testsuiteArea: The testsuite used to check the correctness of rustcArea: The testsuite used to check the correctness of rustcC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-dev-toolsRelevant to the dev-tools subteam, which will review and decide on the PR/issue.Relevant to the dev-tools subteam, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-save-analysisArea: saving results of analyses such as inference and borrowck results to a file.Area: saving results of analyses such as inference and borrowck results to a file.A-testsuiteArea: The testsuite used to check the correctness of rustcArea: The testsuite used to check the correctness of rustcC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-dev-toolsRelevant to the dev-tools subteam, which will review and decide on the PR/issue.Relevant to the dev-tools subteam, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Context
There is currently only one test for
save_analysis. This test ensures that the compiler doesn't crash when dumping crate information as a text file. The lack of further tests allows bugs to be (re)introduced (e.g. #33213) and makes it difficult to make modifications to the API with confidence. It is important to increase the reliability ofsave_analysis, since the future RLS will be implemented on top of it.Requirements
Ideally, we should come up with a clear testing architecture to deal with this problem. It would need to:
Dumptrait and collects all available information about a program inVecs (see below).Integrating with rustc's testing system
Currently, the only test is in
src/test/run-make/save-analysis. This makes sense for checking whether ICEs are triggered, but is probably unsuitable for the fine-grained testing approach described above.We could follow the approach of rustdoc and the pretty printer. For instance, we could add a new directory (
src/test/save-analysis) and put the tests there. We should probably begin with single-file tests.A possible way to encode the constraints of the tests is through comments, as shown below:
Notation:
^^^: the span of the item.1.3-1.5: a span beginning on the third column of the first line and ending on the fifth column of the first line.