Skip to content

Commit 40b6de2

Browse files
committed
Cargo patch
1 parent 0a27c1f commit 40b6de2

File tree

1 file changed

+9
-2
lines changed
  • src/bootstrap/src/core/build_steps

1 file changed

+9
-2
lines changed

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

+9-2
Original file line numberDiff line numberDiff line change
@@ -261,12 +261,16 @@ pub struct Cargo {
261261
host: TargetSelection,
262262
}
263263

264+
impl Cargo {
265+
const CRATE_PATH: &str = "src/tools/cargo";
266+
}
267+
264268
impl Step for Cargo {
265269
type Output = ();
266270
const ONLY_HOSTS: bool = true;
267271

268272
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
269-
run.path("src/tools/cargo")
273+
run.path(Self::CRATE_PATH)
270274
}
271275

272276
fn make_run(run: RunConfig<'_>) {
@@ -284,7 +288,7 @@ impl Step for Cargo {
284288
Mode::ToolRustc,
285289
self.host,
286290
Kind::Test,
287-
"src/tools/cargo",
291+
Self::CRATE_PATH,
288292
SourceType::Submodule,
289293
&[],
290294
);
@@ -299,6 +303,9 @@ impl Step for Cargo {
299303
// those features won't be able to land.
300304
cargo.env("CARGO_TEST_DISABLE_NIGHTLY", "1");
301305
cargo.env("PATH", path_for_cargo(builder, compiler));
306+
// Cargo's test suite requires configurations from its own `.cargo/config.toml`.
307+
// Change to the directory so Cargo can read from it.
308+
cargo.current_dir(builder.src.join(Self::CRATE_PATH));
302309

303310
#[cfg(feature = "build-metrics")]
304311
builder.metrics.begin_test_suite(

0 commit comments

Comments
 (0)