diff options
| author | Jakub Beránek <berykubik@gmail.com> | 2025-08-09 11:51:20 +0200 |
|---|---|---|
| committer | Jakub Beránek <berykubik@gmail.com> | 2025-08-09 11:51:20 +0200 |
| commit | a5ddf5da582d2f1810af7045772bd5934884fdc1 (patch) | |
| tree | 9c79ba4e2f8cb240391a3f7dfd24368a7b549da1 | |
| parent | 2886b36df4a646dd8d82fb65bf0c9d8d96c1f71a (diff) | |
| download | rust-a5ddf5da582d2f1810af7045772bd5934884fdc1.tar.gz rust-a5ddf5da582d2f1810af7045772bd5934884fdc1.zip | |
Override custom Cargo `build-dir` in bootstrap
| -rw-r--r-- | src/bootstrap/src/core/builder/cargo.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/bootstrap/src/core/builder/cargo.rs b/src/bootstrap/src/core/builder/cargo.rs index e10af2b55f9..39f46bf43af 100644 --- a/src/bootstrap/src/core/builder/cargo.rs +++ b/src/bootstrap/src/core/builder/cargo.rs @@ -433,6 +433,15 @@ impl Builder<'_> { let out_dir = self.stage_out(compiler, mode); cargo.env("CARGO_TARGET_DIR", &out_dir); + // Bootstrap makes a lot of assumptions about the artifacts produced in the target + // directory. If users override the "build directory" using `build-dir` + // (https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#build-dir), then + // bootstrap couldn't find these artifacts. So we forcefully override that option to our + // target directory here. + // In the future, we could attempt to read the build-dir location from Cargo and actually + // respect it. + cargo.env("CARGO_BUILD_BUILD_DIR", &out_dir); + // Found with `rg "init_env_logger\("`. If anyone uses `init_env_logger` // from out of tree it shouldn't matter, since x.py is only used for // building in-tree. |
