Skip to content

Commit

Permalink
fix(simple): cfg flag usage for nightly detection
Browse files Browse the repository at this point in the history
Signed-off-by: vados <[email protected]>
  • Loading branch information
t3hmrman committed Sep 11, 2024
1 parent be3a06e commit 69adf1d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions crates/async-dropper-simple/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ use rustc_version::{version_meta, Channel};
fn main() {
// Set cfg flags depending on release channel
let channel = match version_meta().unwrap().channel {
Channel::Stable => "CHANNEL_STABLE",
Channel::Beta => "CHANNEL_BETA",
Channel::Nightly => "CHANNEL_NIGHTLY",
Channel::Dev => "CHANNEL_DEV",
Channel::Stable => "stable",
Channel::Beta => "beta",
Channel::Nightly => "nightly",
Channel::Dev => "dev",
};
println!("cargo:rustc-cfg={}", channel)
println!("cargo:rustc-check-cfg=cfg(channel, values(\"stable\", \"beta\", \"nightly\", \"dev\"))");
println!("cargo:rustc-check=channel={}", channel)
}
2 changes: 1 addition & 1 deletion crates/async-dropper-simple/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![cfg_attr(all(doc, CHANNEL_NIGHTLY), feature(doc_cfg))]
#![cfg_attr(all(doc, channel = "nightly"), feature(doc_cfg))]
//! The code in this file was shamelessly stolen from
//! https://stackoverflow.com/questions/71541765/rust-async-drop

Expand Down

0 comments on commit 69adf1d

Please sign in to comment.