Skip to content

Commit 0bdcd2c

Browse files
committed
propagate --target only if target is not host
Passing `--target` alters `RUSTFLAGS` in the build scripts. Since there is no reason to pass them when building for the host triple, exclude them if the target is the host triple. Signed-off-by: onur-ozkan <[email protected]>
1 parent 3f10032 commit 0bdcd2c

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/bootstrap/src/core/builder.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1343,10 +1343,9 @@ impl<'a> Builder<'a> {
13431343
Color::Auto => {} // nothing to do
13441344
}
13451345

1346-
if cmd != "install" {
1346+
if target != compiler.host {
1347+
assert!(cmd != "install", "`x install` can only be called for the host triple.");
13471348
cargo.arg("--target").arg(target.rustc_target_arg());
1348-
} else {
1349-
assert_eq!(target, compiler.host);
13501349
}
13511350

13521351
if self.config.rust_optimize.is_release() {

src/bootstrap/src/lib.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,13 @@ impl Build {
797797
/// running a particular compiler, whether or not we're building the
798798
/// standard library, and targeting the specified architecture.
799799
fn cargo_out(&self, compiler: Compiler, mode: Mode, target: TargetSelection) -> PathBuf {
800-
self.stage_out(compiler, mode).join(&*target.triple).join(self.cargo_dir())
800+
let stage_out = self.stage_out(compiler, mode);
801+
802+
if self.config.build == target {
803+
stage_out.join(self.cargo_dir())
804+
} else {
805+
stage_out.join(&*target.triple).join(self.cargo_dir())
806+
}
801807
}
802808

803809
/// Root output directory of LLVM for `target`

0 commit comments

Comments
 (0)