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
This commit is contained in:
bors 2016-09-25 15:30:01 -07:00 committed by GitHub
commit 95abee1a68

View File

@ -950,7 +950,11 @@ fn ar(&self, target: &str) -> Option<&Path> {
/// 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`.