diff options
| author | Eric Huss <eric@huss.org> | 2022-08-08 22:51:16 -0700 |
|---|---|---|
| committer | Eric Huss <eric@huss.org> | 2022-08-08 22:51:16 -0700 |
| commit | 2462bd17a029e8333796bb7190bce4bdfc4da91b (patch) | |
| tree | 688fbf166ace4d8a5248f90a78cabffbbe8d5e1e | |
| parent | c86e523d97104d508b98747079f12edd3b53a672 (diff) | |
| download | rust-2462bd17a029e8333796bb7190bce4bdfc4da91b.tar.gz rust-2462bd17a029e8333796bb7190bce4bdfc4da91b.zip | |
compiletest: Add warning and comment about running tests without RUSTC
| -rw-r--r-- | src/tools/compiletest/src/header/tests.rs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/tools/compiletest/src/header/tests.rs b/src/tools/compiletest/src/header/tests.rs index 6c0e8f2e46f..bcd222b5a93 100644 --- a/src/tools/compiletest/src/header/tests.rs +++ b/src/tools/compiletest/src/header/tests.rs @@ -58,7 +58,22 @@ fn config() -> Config { ]; let mut args: Vec<String> = args.iter().map(ToString::to_string).collect(); args.push("--rustc-path".to_string()); - args.push(std::env::var("RUSTC").unwrap_or_else(|_| "rustc".to_string())); + // This is a subtle/fragile thing. On rust-lang CI, there is no global + // `rustc`, and Cargo doesn't offer a convenient way to get the path to + // `rustc`. Fortunately bootstrap sets `RUSTC` for us, which is pointing + // to the stage0 compiler. + // + // Otherwise, if you are running compiletests's tests manually, you + // probably don't have `RUSTC` set, in which case this falls back to the + // global rustc. If your global rustc is too far out of sync with stage0, + // then this may cause confusing errors. Or if for some reason you don't + // have rustc in PATH, that would also fail. + args.push(std::env::var("RUSTC").unwrap_or_else(|_| { + eprintln!( + "warning: RUSTC not set, using global rustc (are you not running via bootstrap?)" + ); + "rustc".to_string() + })); crate::parse_config(args) } |
