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 d05bc03

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

File tree

1 file changed

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

1 file changed

+3
-3
lines changed
 

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -305,9 +305,9 @@ 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. Since we are setting `-Zroot-dir`, they will be relative to that.
310+
cargo.env("CARGO_RUSTC_CURRENT_DIR", builder.src.display().to_string());
311311

312312
#[cfg(feature = "build-metrics")]
313313
builder.metrics.begin_test_suite(

0 commit comments

Comments
 (0)
Failed to load comments.