about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2020-10-14 06:02:25 +0900
committerGitHub <noreply@github.com>2020-10-14 06:02:25 +0900
commitfe7e794b6a55477ec072acace1f500756edb0b5d (patch)
tree210d81fdcd9c6a1ba63196835b27bb504e9429cc
parent1bb6eff53d1392e1fd8b38d71b29a2c560a85532 (diff)
parentb7080e6fd4655d3c9b0c325be84f1b714c99c608 (diff)
downloadrust-fe7e794b6a55477ec072acace1f500756edb0b5d.tar.gz
rust-fe7e794b6a55477ec072acace1f500756edb0b5d.zip
Rollup merge of #77776 - jyn514:wrong-way, r=Mark-Simulacrum
 Give an error when running `x.py test --stage 0 src/test/ui`

The error can be overridden with `COMPILETEST_FORCE_STAGE0=1`. In practice I don't know why anyone would do this.

r? @Mark-Simulacrum

Closes https://github.com/rust-lang/rust/issues/77711
-rw-r--r--src/bootstrap/test.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index 00522ee6b67..bda9e0f5784 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -966,6 +966,15 @@ impl Step for Compiletest {
     /// compiletest `mode` and `suite` arguments. For example `mode` can be
     /// "run-pass" or `suite` can be something like `debuginfo`.
     fn run(self, builder: &Builder<'_>) {
+        if builder.top_stage == 0 && env::var("COMPILETEST_FORCE_STAGE0").is_err() {
+            eprintln!("\
+error: `--stage 0` runs compiletest on the beta compiler, not your local changes, and will almost always cause tests to fail
+help: use `--stage 1` instead
+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`."
+            );
+            std::process::exit(1);
+        }
+
         let compiler = self.compiler;
         let target = self.target;
         let mode = self.mode;