forked from moka-rs/moka
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.rs
35 lines (30 loc) · 760 Bytes
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#![allow(unexpected_cfgs)] // for `#[cfg(rustver)]` in this build.rs.
const ALLOWED_CFG_NAMES: &[&str] = &[
"armv5te",
"beta_clippy",
"kani",
"mips",
"rustver",
"skip_large_mem_tests",
"trybuild",
];
#[cfg(rustver)]
fn main() {
use rustc_version::version;
let version = version().expect("Can't get the rustc version");
println!(
"cargo:rustc-env=RUSTC_SEMVER={}.{}",
version.major, version.minor
);
allow_cfgs(ALLOWED_CFG_NAMES);
}
#[cfg(not(rustver))]
fn main() {
allow_cfgs(ALLOWED_CFG_NAMES);
}
/// Tells `rustc` to allow `#[cfg(...)]` with the given names.
fn allow_cfgs(names: &[&str]) {
for name in names.iter() {
println!("cargo:rustc-check-cfg=cfg({name})");
}
}