Skip to content

Commit 95abee1

Browse files
authored
Auto merge of #36442 - alexcrichton:rustbuild-cross, r=brson
rustbuild: Nicer error for host builds of targets If a triple is configured only as a target, not a host, then trying to build that triple with host artifacts would cause a panic. Fail a little nicer instead. Closes #36268
2 parents 5fc14c1 + 6d78620 commit 95abee1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Diff for: src/bootstrap/lib.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,11 @@ impl Build {
950950
/// Returns the path to the C++ compiler for the target specified, may panic
951951
/// if no C++ compiler was configured for the target.
952952
fn cxx(&self, target: &str) -> &Path {
953-
self.cxx[target].path()
953+
match self.cxx.get(target) {
954+
Some(p) => p.path(),
955+
None => panic!("\n\ntarget `{}` is not configured as a host,
956+
only as a target\n\n", target),
957+
}
954958
}
955959

956960
/// Returns flags to pass to the compiler to generate code for `target`.

0 commit comments

Comments
 (0)