about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2024-12-01 11:04:17 +0100
committerRalf Jung <post@ralfj.de>2024-12-01 11:21:41 +0100
commitdd2ac08cfefd66cf827b1ced863d98cc7f09d279 (patch)
tree0b49918124341fac85bd141627c96e0e96058792 /src/bootstrap
parentc4cab8a15c9d5cd739ffa4db31c25ab02942a353 (diff)
downloadrust-dd2ac08cfefd66cf827b1ced863d98cc7f09d279.tar.gz
rust-dd2ac08cfefd66cf827b1ced863d98cc7f09d279.zip
fix cargo path logic
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/src/core/build_steps/test.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs
index f670452f4ef..4fa91c1a571 100644
--- a/src/bootstrap/src/core/build_steps/test.rs
+++ b/src/bootstrap/src/core/build_steps/test.rs
@@ -305,9 +305,10 @@ impl Step for Cargo {
         // those features won't be able to land.
         cargo.env("CARGO_TEST_DISABLE_NIGHTLY", "1");
         cargo.env("PATH", path_for_cargo(builder, compiler));
-        // Cargo's test suite requires configurations from its own `.cargo/config.toml`.
-        // Change to the directory so Cargo can read from it.
-        cargo.current_dir(builder.src.join(Self::CRATE_PATH));
+        // Cargo's test suite uses `CARGO_RUSTC_CURRENT_DIR` to determine the path that `file!` is
+        // relative to. Cargo no longer sets this env var, so we have to do that. This has to be the
+        // same value as `-Zroot-dir`.
+        cargo.env("CARGO_RUSTC_CURRENT_DIR", builder.src.display().to_string());
 
         #[cfg(feature = "build-metrics")]
         builder.metrics.begin_test_suite(