about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2016-10-13 12:01:59 -0700
committerAlex Crichton <alex@alexcrichton.com>2016-10-13 12:02:27 -0700
commit651bb69ecd82cc58aa7d967563784e989fab7873 (patch)
tree085a94ae802b3c4423ba866c07078087feab88a1
parent9cb01365eed598811aef847a8ee414dab576f3c8 (diff)
downloadrust-651bb69ecd82cc58aa7d967563784e989fab7873.tar.gz
rust-651bb69ecd82cc58aa7d967563784e989fab7873.zip
rustbuild: Less panics in musl_root
Don't panic if the target wasn't configured.
-rw-r--r--src/bootstrap/lib.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
index 12938b8326e..30983869c2e 100644
--- a/src/bootstrap/lib.rs
+++ b/src/bootstrap/lib.rs
@@ -991,7 +991,8 @@ impl Build {
 
     /// Returns the "musl root" for this `target`, if defined
     fn musl_root(&self, target: &str) -> Option<&Path> {
-        self.config.target_config[target].musl_root.as_ref()
+        self.config.target_config.get(target)
+            .and_then(|t| t.musl_root.as_ref())
             .or(self.config.musl_root.as_ref())
             .map(|p| &**p)
     }