-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Add "modes" to compiletest, for running all tests with NLL enabled and comparing with master #48879
Copy link
Copy link
Closed
Labels
A-compiletestArea: The compiletest test runnerArea: The compiletest test runnerA-compiletest-compare-modesArea: compiletest compare-modesArea: compiletest compare-modesA-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.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.NLL-diagnosticsWorking towards the "diagnostic parity" goalWorking towards the "diagnostic parity" goalT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Milestone
Metadata
Metadata
Assignees
Labels
A-compiletestArea: The compiletest test runnerArea: The compiletest test runnerA-compiletest-compare-modesArea: compiletest compare-modesArea: compiletest compare-modesA-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.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.NLL-diagnosticsWorking towards the "diagnostic parity" goalWorking towards the "diagnostic parity" goalT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
The NLL team has been trying to find a good workflow for evaluating the discrepancies between AST borrowck and NLL-based borrowck.
-Z borrowck=compareand the https://github.com/pnkfelix/nll-probe tool, but here I'm going to try to avoid a deep dive into how those have failed to satisfy our needs.Our goal here: We want a way to track the current state of NLL, including the cases where there are known deviations, in a manner that allows immediate analysis of that state to determine things like:
Here's a new proposal for a (hopefully) relatively small change to
compiletestthat should yield an easier workflow to answer questions like those above, at least for theui/subset of our tests.ui/tests are set up so that each test consists of an input$file.rs, and a set of expected outputs in$file.stderr(compilation error messages) and$file.stdout(non erroneous compiler output; rarely used). (For more info, see this chapter in the rustc-guide.)compiletest, encoded either as a command line parameter or as an environment variable, or both. (The first mode we'll support will be "nll", which tellscompiletestto pass-Z nllin addition to any other flags when invokingrustc, at least for theui/tests).$file.$mode.stderrfile, then this file will be used as the source of "acceptable output". If there is no such file, thencompiletestwill fallback to the regular filename$file.stderr.//~ ERRORthat indicate what error is expected on which line (these are mildly redundant with the stderr files above). Because messages may differ in the mode M, but we don't want to edit the sources too much, compiletest should just ignore the//~ ERRORannotations when running in a particular mode. We will still see the errors that occur from the stderr output, it's just less convenient.$file.$mode.stderr, then some tool (probablycompiletest, but maybetidy?) will be responsible to checking that$file.rssomewhere contains a comment that explains the source of the discrepancy. This could be a specially formatted FIXME, if the new behavior seems worse than before:// $mode FIXME(#123) -- summary of discrepancy caused by NLL bug with corresponding issue numor a "YAYME" comment for when the new behavior is an improvement:
// $mode YAYME(#123) -- summary of a beneficial discrepancy(presumably the ticket linked by YAYME would just be the tracking issue for NLL or whatever other mode is being tested).
Benefits of the proposed system:
ls *.nll.stderrdiff onetest.stderr onetest.nll.stderr*.$mode.stderrfiles.Open Questions (to be resolved by implementor)
compiletestdo about occurrences of//~ ERRORin the source text? In particular, should it check that the error output still has those cases, even when running under a given mode?compiletestto ignore the//~ ERRORannotations when running under a given mode. The reasoning here is this: the//~ ERRORannotations will already get checked by compiletest runs that don't have a mode. We probably don't want to force an error when there's a discrepancy when running under a given mode; any discrepancies, including any of those errors disappearing, should be accounted for in the linked// $mode FIXME/YAYMEissue, and we want to allow them to disappear or differ.