Skip to content

Commit 6331fdf

Browse files
author
Jorge Aparicio
committed
bump rustc-cfg version and show a better error message when it fails
1 parent 954e3b7 commit 6331fdf

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ version = "0.1.0"
66

77
[build-dependencies]
88
gcc = "0.3.35"
9-
rustc-cfg = "0.1.2"
9+
rustc-cfg = "0.2.0"
1010

1111
[dependencies]
1212

build.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ extern crate gcc;
22
extern crate rustc_cfg;
33

44
use std::collections::BTreeMap;
5-
use std::env;
5+
use std::io::Write;
66
use std::path::Path;
7+
use std::{env, io, process};
78

89
use rustc_cfg::Cfg;
910

@@ -50,7 +51,10 @@ fn main() {
5051

5152
let target = env::var("TARGET").unwrap();
5253
let Cfg { ref target_arch, ref target_os, ref target_env, ref target_vendor, .. } =
53-
Cfg::new(&target).unwrap();
54+
Cfg::new(&target).unwrap_or_else(|e| {
55+
writeln!(io::stderr(), "{}", e).ok();
56+
process::exit(1)
57+
});
5458
// NOTE we are going to assume that llvm-target, what determines our codegen option, matches the
5559
// target triple. This is usually correct for our built-in targets but can break in presence of
5660
// custom targets, which can have arbitrary names.

0 commit comments

Comments
 (0)