Skip to content

Commit

Permalink
Merge #604
Browse files Browse the repository at this point in the history
604: Do not fail to compile if autocfg unable to determine rustc version r=taiki-e a=taiki-e

`autocfg::new()` panics if unable to determine rustc version. However, that should not be a fatal error for the library.

Co-authored-by: Taiki Endo <te316e89@gmail.com>
  • Loading branch information
bors[bot] and taiki-e committed Nov 22, 2020
2 parents 3b14dec + d9ff1c2 commit ccbad40
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion crossbeam-utils/build.rs
@@ -1,5 +1,20 @@
use autocfg::AutoCfg;

// The rustc-cfg strings below are *not* public API. Please let us know by
// opening a GitHub issue if your build environment requires some way to enable
// these cfgs other than by executing our build script.
fn main() {
let cfg = autocfg::new();
let cfg = match AutoCfg::new() {
Ok(cfg) => cfg,
Err(e) => {
println!(
"cargo:warning=crossbeam-utils: unable to determine rustc version: {}",
e
);
return;
}
};

cfg.emit_type_cfg("core::sync::atomic::AtomicU8", "has_atomic_u8");
cfg.emit_type_cfg("core::sync::atomic::AtomicU16", "has_atomic_u16");
cfg.emit_type_cfg("core::sync::atomic::AtomicU32", "has_atomic_u32");
Expand Down

0 comments on commit ccbad40

Please sign in to comment.