Miscellaneous testing-related info
RUSTC_BOOTSTRAP
and stability
This is a bootstrap/compiler implementation detail, but it can also be useful for testing:
RUSTC_BOOTSTRAP=1
will "cheat" and bypass usual stability checking, allowing you to use unstable features and cli flags on a stablerustc
.RUSTC_BOOTSTRAP=-1
will force a givenrustc
to pretend that is a stable compiler, even if it's actually a nightlyrustc
. This is useful because some behaviors of the compiler (e.g. diagnostics) can differ depending on whether the compiler is nightly or not.
In ui
tests and other test suites that support //@ rustc-env
, you can specify
// Force unstable features to be usable on stable rustc
//@ rustc-env:RUSTC_BOOTSTRAP=1
// Or force nightly rustc to pretend it is a stable rustc
//@ rustc-env:RUSTC_BOOTSTRAP=-1
For run-make
tests, //@ rustc-env
is not supported. You can do something
like the following for individual rustc
invocations.
use run_make_support::rustc;
fn main() {
rustc()
// Pretend that I am very stable
.env("RUSTC_BOOTSTRAP", "-1")
//...
.run();
}