fix cargo path logic · rust-lang/rust@dd2ac08 (original) (raw)
File tree
1 file changed
lines changed
- src/bootstrap/src/core/build_steps
1 file changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -305,9 +305,10 @@ impl Step for Cargo { | ||
305 | 305 | // those features won't be able to land. |
306 | 306 | cargo.env("CARGO_TEST_DISABLE_NIGHTLY", "1"); |
307 | 307 | 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()); | |
311 | 312 | |
312 | 313 | #[cfg(feature = "build-metrics")] |
313 | 314 | builder.metrics.begin_test_suite( |