From 651bb69ecd82cc58aa7d967563784e989fab7873 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 13 Oct 2016 12:01:59 -0700 Subject: [PATCH] rustbuild: Less panics in musl_root Don't panic if the target wasn't configured. --- src/bootstrap/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 12938b8326e79..30983869c2e3b 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) }