mirror of
https://gitee.com/openharmony/third_party_rust_memoffset
synced 2024-11-23 07:10:22 +00:00
Switch to autocfg from rustc_version
This commit is contained in:
parent
73f5dddc90
commit
449841d45d
@ -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"
|
||||
|
14
build.rs
14
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");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user