From bd7b8b3612f8b62d215cac218f752a28eada7d7e Mon Sep 17 00:00:00 2001 From: Jieyou Xu Date: Fri, 1 Aug 2025 21:29:05 +0800 Subject: Properly pass path to staged `rustc` to `compiletest` self-tests Otherwise, this can do weird things like use a global rustc, or try to use stage 0 rustc. This must be properly configured, because `compiletest` is intended to only support one compiler target spec JSON format (of the in-tree compiler). --- src/bootstrap/src/core/build_steps/test.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/bootstrap') diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index 951ca73fcc4..3eadd325b81 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -749,6 +749,12 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the SourceType::InTree, &[], ); + + // Used for `compiletest` self-tests to have the path to the *staged* compiler. Getting this + // right is important, as `compiletest` is intended to only support one target spec JSON + // format, namely that of the staged compiler. + cargo.env("TEST_RUSTC", builder.rustc(compiler)); + cargo.allow_features(COMPILETEST_ALLOW_FEATURES); run_cargo_test(cargo, &[], &[], "compiletest self test", host, builder); } -- cgit 1.4.1-3-g733a5