Run the UI test suite with multiple editions #861
Labels
major-change
A proposal to make a major change to rustc
T-compiler
Add this label so rfcbot knows to poll the compiler team
Proposal
Right now the whole UI test suite is executed under edition 2015, unless a test opts into another one.
While in general this is fine (most code doesn't change behavior between editions), it prevents testing that the test suite passes on all editions.
This is something we need to do in Ferrocene, and it might also be desirable for the project to test it too in the future.
The good news is, compiletest already allows changing the default edition:
Unfortunately, some test files are not compatible with newer editions.
For example, running the UI test suite with
--edition 2021
causes 740 tests to fail in a recent-ish clone of the master branch.This MCP proposes we update the test suite so that it's compatible with all editions.
I didn't manually check all the failures, but by grouping them by failure reason (and spot checking some of them) none of the failures seem to indicate actual bugs.
Rather, a lot of tests depend on the 2015 module system, omit the
dyn
keyword, try to run rustfix without specifying an edition, or similar cases.This MCP thus makes four proposals.
Fix tests that fail on 2018 and newer
We should go through all the test failures and make sure all tests work on editions 2018, 2021 and 2024.
While this will have to be a manual effort, most of the failures have the same underlying cause.
So it will be possible to send PRs like "add
dyn
to every test" instead of huge PRs with miscellaneous fixes in them.Add a CI job running the test suite in all supported editions
We should add a CI job running
./x test tests/ui --test-args=--edition=YYYY
for all supported editions.This job can run on a single platform, as its goal would be to ensure we don't accidentally add new tests that only work in a few editions.
Running it on a single platform won't catch all failures (if there are
//@only-windows
tests or similar), but it would provide enough coverage without costing too many resources.Add range syntax to
//@ edition
While a small subset of tests can run only on a single edition (for example rustfix tests converting from 2018 to 2021), most of the uses of
//@ edition
mean "this test requires at least this edition".We should add a way to specify a range of supported editions, and update most tests to use it.
The syntax is bikesheddable, a possibility would be to implement ranges in the field:
When a range is specified, compiletest will pick the default version if it fits within the range, or otherwise the lowest version in the range.
Add a compiletest flag to only test the default edition
It would be helpful to add a compiletest flag to automatically ignore tests meant for an edition different than the one specified in
--edition
.This would be helpful for the CI job mentioned above, and for Ferrocene use.
It would not be enabled by default.
Mentors or Reviewers
Process
The main points of the Major Change Process are as follows:
@rustbot second
.-C flag
, then full team check-off is required.@rfcbot fcp merge
on either the MCP or the PR.You can read more about Major Change Proposals on forge.
The text was updated successfully, but these errors were encountered: