Skip to content

Commit a5ddf5d

Browse files
committed
Override custom Cargo build-dir in bootstrap
1 parent 2886b36 commit a5ddf5d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/bootstrap/src/core/builder/cargo.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,15 @@ impl Builder<'_> {
433433
let out_dir = self.stage_out(compiler, mode);
434434
cargo.env("CARGO_TARGET_DIR", &out_dir);
435435

436+
// Bootstrap makes a lot of assumptions about the artifacts produced in the target
437+
// directory. If users override the "build directory" using `build-dir`
438+
// (https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#build-dir), then
439+
// bootstrap couldn't find these artifacts. So we forcefully override that option to our
440+
// target directory here.
441+
// In the future, we could attempt to read the build-dir location from Cargo and actually
442+
// respect it.
443+
cargo.env("CARGO_BUILD_BUILD_DIR", &out_dir);
444+
436445
// Found with `rg "init_env_logger\("`. If anyone uses `init_env_logger`
437446
// from out of tree it shouldn't matter, since x.py is only used for
438447
// building in-tree.

0 commit comments

Comments
 (0)