Conversation
|
The rustc-dev-guide subtree was changed. If your future PRs only touch the subtree, consider submitting them directly to rust-lang/rustc-dev-guide, which is where the document is primarily maintained (and has faster CI). Some changes occurred in src/tools/compiletest cc @jieyouxu |
This comment has been minimized.
This comment has been minimized.
80eb9e2 to
9565273
Compare
|
You can probably remove rust/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh Lines 162 to 167 in c165834 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
9565273 to
a36b6f8
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
This comment has been minimized.
This comment has been minimized.
a36b6f8 to
8e072e8
Compare
Right now, it is not possible to test how the compiler behaves on the stable toolchain in UI tests. Even though #132993 added a mechanism to emulate stable rustc on the nightly channel, using the
RUSTC_BOOTSTRAP=-1environment variable, this mechanism is not currently usable within compiletest and UI tests directly, because compiletest unconditionally passes several unstable-Zflags that are load-bearing for the testing infra itself to work (notably-Zui-testingand friends).That is quite annoying, because we do in fact want to test stable behavior in a couple of tests, but today we have to write those as
run-maketests (latest example: https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Testing.20stable.20vs.20nightly.20behavior.20in.20UI.20tests/with/628206707), even if the tested situation is very simple. Those are harder to read, write and maintain than UI tests and they do not support blessing outputs as well as UI tests. Recently, I at least added #163444 as a way of centralizing the logic of testing a stablerustcin a run-make test, but that does not really help with the fact that we still have to use run-make tests for it, even when a normal UI test would do.For #162848, I would also like to have a way of passing
-Zthreads=1to all run-make tests, even if they are testing stablerustc, but that's not easily possible, because those tests are usingRUSTC_BOOTSTRAP=-1.This PR proposes to add a new mode to
RUSTC_BOOTSTRAP, with the value of-21. This can be used to emulate the behavior of stable rustc, while still allowing passing unstable-Zflags (and-Zunstable-options) to the compiler.The stability check in the compiler is thus now separated into two questions:
The latter is checked only at a few places, so the necessary change to the compiler is rather small (IMO).
To demonstrate how this would be used, I also implemented a new directive into compiletest in this PR,
act-as-stable. That can be used in a UI test to emulate stable rustc. Some tests before usedonly-stableto "achieve" this, which is very misleading, because it doesn't work at all 😆, due to compiletest unconditionally passingRUSTC_BOOTSTRAP=1to all executed tests.act-as-stablefixes that.The last two commits demonstrate how we could replace run-make tests that tested different output on stable/nightly with UI tests.
I suppose that this mode might be interesting for other people outside of
rust-lang/rust, but if you don't want that, I can gate it behind-Zui-testing.r? jieyouxu
Footnotes
Note that
RUSTC_BOOTSTRAP=<crate-identifier>is a thing, so we cannot that easily name the values for this flag with strings that from valid Rust identifiers. Which is why I just chose-2. ↩