From da1081a8f43c3f7ea617a38e509b7d6c301d9d36 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Sun, 22 Nov 2020 11:55:16 +0900 Subject: [PATCH] Do not fail to compile if autocfg unable to determine rustc version --- crossbeam-utils/build.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/crossbeam-utils/build.rs b/crossbeam-utils/build.rs index 86c40ab9b..df52eddc7 100644 --- a/crossbeam-utils/build.rs +++ b/crossbeam-utils/build.rs @@ -1,5 +1,17 @@ +use autocfg::AutoCfg; + 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");