You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Instead of the ad-hoc `COMPILETEST_FORCE_STAGE0` env var. This config is
intended to allow `compiletest` self-tests and `compiletest`-managed
test suites to run against a stage 0 rustc, which is *usually* not a
supported use case. It's intended only for the case where the stage 0
rustc is actually built from in-tree sources.
Copy file name to clipboardExpand all lines: src/bootstrap/src/core/build_steps/test.rs
+14-6Lines changed: 14 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -715,6 +715,15 @@ impl Step for CompiletestTest {
715
715
/// Runs `cargo test` for compiletest.
716
716
fnrun(self,builder:&Builder<'_>){
717
717
let host = self.host;
718
+
719
+
if builder.top_stage == 0 && !builder.config.compiletest_allow_stage0{
720
+
eprintln!("\
721
+
ERROR: `--stage 0` runs compiletest self-tests against the stage0 (precompiled) compiler, not the in-tree compiler, and will almost always cause tests to fail
722
+
NOTE: if you're sure you want to do this, please open an issue as to why. In the meantime, you can override this with `--set build.compiletest-allow-stage0=true`."
723
+
);
724
+
crate::exit!(1);
725
+
}
726
+
718
727
let compiler = builder.compiler(builder.top_stage, host);
719
728
720
729
// We need `ToolStd` for the locally-built sysroot because
@@ -723,8 +732,8 @@ impl Step for CompiletestTest {
723
732
letmut cargo = tool::prepare_tool_cargo(
724
733
builder,
725
734
compiler,
726
-
// compiletest uses libtest internals; make it use the in-tree std to make sure it never breaks
727
-
// when std sources change.
735
+
// compiletest uses libtest internals; make it use the in-tree std to make sure it never
736
+
// breaks when std sources change.
728
737
Mode::ToolStd,
729
738
host,
730
739
Kind::Test,
@@ -1612,12 +1621,11 @@ impl Step for Compiletest {
1612
1621
return;
1613
1622
}
1614
1623
1615
-
if builder.top_stage == 0 && env::var("COMPILETEST_FORCE_STAGE0").is_err(){
1624
+
if builder.top_stage == 0 && !builder.config.compiletest_allow_stage0{
1616
1625
eprintln!("\
1617
1626
ERROR: `--stage 0` runs compiletest on the stage0 (precompiled) compiler, not your local changes, and will almost always cause tests to fail
1618
-
HELP: to test the compiler, use `--stage 1` instead
1619
-
HELP: to test the standard library, use `--stage 0 library/std` instead
1620
-
NOTE: if you're sure you want to do this, please open an issue as to why. In the meantime, you can override this with `COMPILETEST_FORCE_STAGE0=1`."
1627
+
HELP: to test the compiler or standard library, omit the stage or explicitly use `--stage 1` instead
1628
+
NOTE: if you're sure you want to do this, please open an issue as to why. In the meantime, you can override this with `--set build.compiletest-allow-stage0=true`."
0 commit comments