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"); } }