We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c9ab938 commit ed2027bCopy full SHA for ed2027b
build.rs
@@ -1,12 +1,8 @@
1
-use rustc_version::{version_meta, Channel};
+use rustc_version::{version_meta, Channel, VersionMeta};
2
3
fn main() {
4
- // Set cfg flags depending on release channel
5
- let channel = match version_meta().unwrap().channel {
6
- Channel::Stable => "CHANNEL_STABLE",
7
- Channel::Beta => "CHANNEL_BETA",
8
- Channel::Nightly => "CHANNEL_NIGHTLY",
9
- Channel::Dev => "CHANNEL_DEV",
10
- };
11
- println!("cargo:rustc-cfg={channel}")
+ println!("cargo::rustc-check-cfg=cfg(CHANNEL_NIGHTLY)");
+ if matches!(version_meta(), Ok(VersionMeta { channel: Channel::Nightly, .. })) {
+ println!("cargo:rustc-cfg=CHANNEL_NIGHTLY");
+ }
12
}
0 commit comments