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
This commit is contained in:
parent
fa9d8cc8ac
commit
6d78620bd7
@ -959,7 +959,11 @@ impl Build {
|
||||
/// Returns the path to the C++ compiler for the target specified, may panic
|
||||
/// if no C++ compiler was configured for the target.
|
||||
fn cxx(&self, target: &str) -> &Path {
|
||||
self.cxx[target].path()
|
||||
match self.cxx.get(target) {
|
||||
Some(p) => p.path(),
|
||||
None => panic!("\n\ntarget `{}` is not configured as a host,
|
||||
only as a target\n\n", target),
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns flags to pass to the compiler to generate code for `target`.
|
||||
|
Loading…
Reference in New Issue
Block a user