Skip to content

Commit 5fa483c

Browse files
committed
Cargo patch
1 parent 583e26c commit 5fa483c

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
@@ -263,12 +263,16 @@ pub struct Cargo {
263263
host: TargetSelection,
264264
}
265265

266+
impl Cargo {
267+
const CRATE_PATH: &str = "src/tools/cargo";
268+
}
269+
266270
impl Step for Cargo {
267271
type Output = ();
268272
const ONLY_HOSTS: bool = true;
269273

270274
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
271-
run.path("src/tools/cargo")
275+
run.path(Self::CRATE_PATH)
272276
}
273277

274278
fn make_run(run: RunConfig<'_>) {
@@ -286,7 +290,7 @@ impl Step for Cargo {
286290
Mode::ToolRustc,
287291
self.host,
288292
Kind::Test,
289-
"src/tools/cargo",
293+
Self::CRATE_PATH,
290294
SourceType::Submodule,
291295
&[],
292296
);
@@ -301,6 +305,9 @@ impl Step for Cargo {
301305
// those features won't be able to land.
302306
cargo.env("CARGO_TEST_DISABLE_NIGHTLY", "1");
303307
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));
304311

305312
#[cfg(feature = "build-metrics")]
306313
builder.metrics.begin_test_suite(

0 commit comments

Comments
 (0)