Auto merge of #31248 - ruud-v-a:fix-triple-ice, r=nrc

This fixes #31238.

r? @michaelsproul
This commit is contained in:
bors
2016-01-29 17:52:26 +00:00

View File

@@ -168,20 +168,24 @@ pub fn expand_build_diagnostic_array<'cx>(ecx: &'cx mut ExtCtxt,
}; };
// Output error metadata to `tmp/extended-errors/<target arch>/<crate name>.json` // Output error metadata to `tmp/extended-errors/<target arch>/<crate name>.json`
let target_triple = env::var("CFG_COMPILER_HOST_TRIPLE") if let Ok(target_triple) = env::var("CFG_COMPILER_HOST_TRIPLE") {
.ok().expect("unable to determine target arch from $CFG_COMPILER_HOST_TRIPLE"); with_registered_diagnostics(|diagnostics| {
if let Err(e) = output_metadata(ecx,
with_registered_diagnostics(|diagnostics| { &target_triple,
if let Err(e) = output_metadata(ecx, &crate_name.name.as_str(),
&target_triple, &diagnostics) {
&crate_name.name.as_str(), ecx.span_bug(span, &format!(
&diagnostics) { "error writing metadata for triple `{}` and crate `{}`, error: {}, \
ecx.span_bug(span, &format!( cause: {:?}",
"error writing metadata for triple `{}` and crate `{}`, error: {}, cause: {:?}", target_triple, crate_name, e.description(), e.cause()
target_triple, crate_name, e.description(), e.cause() ));
)); }
} });
}); } else {
ecx.span_err(span, &format!(
"failed to write metadata for crate `{}` because $CFG_COMPILER_HOST_TRIPLE is not set",
crate_name));
}
// Construct the output expression. // Construct the output expression.
let (count, expr) = let (count, expr) =