-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbuild.rs
More file actions
28 lines (22 loc) · 1004 Bytes
/
Copy pathbuild.rs
File metadata and controls
28 lines (22 loc) · 1004 Bytes
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
use rustc_version::{version_meta, Channel};
fn main() {
let async_feature = std::env::var_os("CARGO_FEATURE_ASYNC").is_some();
let sync_feature = std::env::var_os("CARGO_FEATURE_SYNC").is_some();
let sync_wrappers_feature = std::env::var_os("CARGO_FEATURE_SYNC_WRAPPERS").is_some();
if !async_feature && !sync_feature {
panic!("Either the `async` feature (included in defaults) or `sync` must be enabled!");
}
if sync_wrappers_feature && sync_feature {
panic!("The `sync` feature conflicts with `sync-wrappers`. Consider using `sync` alone.");
}
if async_feature && sync_feature {
panic!(
"The `async` and `sync` features are mutually exclusive. \
`async` is in defaults, so use `--no-default-features --features=sync` for sync mode."
);
}
println!("cargo:rustc-check-cfg=cfg(nightly)");
if version_meta().unwrap().channel == Channel::Nightly {
println!("cargo:rustc-cfg=nightly");
}
}