-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathbuild.rs
More file actions
20 lines (16 loc) · 848 Bytes
/
build.rs
File metadata and controls
20 lines (16 loc) · 848 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use rustc_version::{version_meta, Channel, Version};
fn main() {
println!("cargo::rustc-check-cfg=cfg(USE_RUSTC_FEATURES)");
println!("cargo::rustc-check-cfg=cfg(CONFIG_RUSTC_HAS_UNSAFE_PINNED)");
let meta = version_meta().unwrap();
let use_feature = meta.channel == Channel::Nightly || option_env!("RUSTC_BOOTSTRAP").is_some();
if use_feature {
// Use this cfg option to control whether we should enable features that are already stable
// in some new Rust versions, but are available as unstable features in older Rust versions
// that needs to be supported by the Linux kernel.
println!("cargo:rustc-cfg=USE_RUSTC_FEATURES");
}
if meta.semver >= Version::parse("1.89.0-nightly").unwrap() && use_feature {
println!("cargo:rustc-cfg=CONFIG_RUSTC_HAS_UNSAFE_PINNED");
}
}