From c150ad4941e5e7d87bcd3b487ea2debff0657aa1 Mon Sep 17 00:00:00 2001 From: Gilad Naaman Date: Mon, 16 Mar 2020 19:07:13 +0200 Subject: [PATCH] Switch to autocfg from rustc_version --- Cargo.toml | 2 +- build.rs | 14 ++++---------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a7cf2e2..0cc174e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ keywords = ["mem", "offset", "offset_of", "offsetof"] categories = ["no-std"] [build-dependencies] -rustc_version = "0.2.3" +autocfg = "1" [dev-dependencies] doc-comment = "0.3" diff --git a/build.rs b/build.rs index 757de7d..8bc3c9f 100644 --- a/build.rs +++ b/build.rs @@ -1,20 +1,14 @@ -extern crate rustc_version; -use rustc_version::{version, Version}; - fn main() { - let version = version().unwrap(); - - // Assert we haven't travelled back in time - assert!(version.major >= 1); + let ac = autocfg::new(); // Check for a minimum version for a few features - if version >= Version::from((1, 31, 0)) { + if ac.probe_rustc_version(1, 31) { println!("cargo:rustc-cfg=allow_clippy"); } - if version >= Version::from((1, 36, 0)) { + if ac.probe_rustc_version(1, 36) { println!("cargo:rustc-cfg=maybe_uninit"); } - if version >= Version::from((1, 40, 0)) { + if ac.probe_rustc_version(1, 40) { println!("cargo:rustc-cfg=doctests"); } }