Skip to content

Commit e4b4c4d

Browse files
committed
be resilient against a changed build.build-dir
1 parent 232d995 commit e4b4c4d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,8 +480,10 @@ panic = 'unwind'
480480
// Set rustflags.
481481
cmd.env("CARGO_ENCODED_RUSTFLAGS", encode_rustflags(&self.rustflags));
482482
// Make sure the results end up where we expect them.
483+
// Cargo provides multiple ways to adjust this and we need to overwrite all of them.
483484
let build_target_dir = build_dir.path().join("target");
484485
cmd.env("CARGO_TARGET_DIR", &build_target_dir);
486+
cmd.env("CARGO_BUILD_BUILD_DIR", &build_target_dir);
485487
// To avoid metadata conflicts, we need to inject some custom data into the crate hash.
486488
// bootstrap does the same at
487489
// <https://github.com/rust-lang/rust/blob/c8e12cc8bf0de646234524924f39c85d9f3c7c37/src/bootstrap/builder.rs#L1613>.

0 commit comments

Comments
 (0)