From 4e7d7c7cd832dd7fee4568a0e81c519af53c8769 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Mon, 3 Oct 2016 09:12:13 -0500 Subject: [PATCH] bump rustc-cfg version and show a better error message when it fails --- library/compiler-builtins/Cargo.toml | 2 +- library/compiler-builtins/build.rs | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/library/compiler-builtins/Cargo.toml b/library/compiler-builtins/Cargo.toml index 93f7d1970125..c198d9f3ccb6 100644 --- a/library/compiler-builtins/Cargo.toml +++ b/library/compiler-builtins/Cargo.toml @@ -6,7 +6,7 @@ version = "0.1.0" [build-dependencies] gcc = "0.3.35" -rustc-cfg = "0.1.2" +rustc-cfg = "0.2.0" [dependencies] diff --git a/library/compiler-builtins/build.rs b/library/compiler-builtins/build.rs index a05a1a590ad2..cf9a24e3b1f7 100644 --- a/library/compiler-builtins/build.rs +++ b/library/compiler-builtins/build.rs @@ -2,8 +2,9 @@ extern crate gcc; extern crate rustc_cfg; use std::collections::BTreeMap; -use std::env; +use std::io::Write; use std::path::Path; +use std::{env, io, process}; use rustc_cfg::Cfg; @@ -50,7 +51,10 @@ fn main() { let target = env::var("TARGET").unwrap(); let Cfg { ref target_arch, ref target_os, ref target_env, ref target_vendor, .. } = - Cfg::new(&target).unwrap(); + Cfg::new(&target).unwrap_or_else(|e| { + writeln!(io::stderr(), "{}", e).ok(); + process::exit(1) + }); // NOTE we are going to assume that llvm-target, what determines our codegen option, matches the // target triple. This is usually correct for our built-in targets but can break in presence of // custom targets, which can have arbitrary names.