Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit dd2ac08

Browse files
committedDec 1, 2024
fix cargo path logic
1 parent c4cab8a commit dd2ac08

File tree

1 file changed

+4
-3
lines changed
  • src/bootstrap/src/core/build_steps

1 file changed

+4
-3
lines changed
 

‎src/bootstrap/src/core/build_steps/test.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -305,9 +305,10 @@ impl Step for Cargo {
305305
// those features won't be able to land.
306306
cargo.env("CARGO_TEST_DISABLE_NIGHTLY", "1");
307307
cargo.env("PATH", path_for_cargo(builder, compiler));
308-
// Cargo's test suite requires configurations from its own `.cargo/config.toml`.
309-
// Change to the directory so Cargo can read from it.
310-
cargo.current_dir(builder.src.join(Self::CRATE_PATH));
308+
// Cargo's test suite uses `CARGO_RUSTC_CURRENT_DIR` to determine the path that `file!` is
309+
// relative to. Cargo no longer sets this env var, so we have to do that. This has to be the
310+
// same value as `-Zroot-dir`.
311+
cargo.env("CARGO_RUSTC_CURRENT_DIR", builder.src.display().to_string());
311312

312313
#[cfg(feature = "build-metrics")]
313314
builder.metrics.begin_test_suite(

0 commit comments

Comments
 (0)
Failed to load comments.