diff --git a/crates/async-dropper-simple/build.rs b/crates/async-dropper-simple/build.rs index 4b05b5c..13a674f 100644 --- a/crates/async-dropper-simple/build.rs +++ b/crates/async-dropper-simple/build.rs @@ -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) } diff --git a/crates/async-dropper-simple/src/lib.rs b/crates/async-dropper-simple/src/lib.rs index a107f01..19ef377 100644 --- a/crates/async-dropper-simple/src/lib.rs +++ b/crates/async-dropper-simple/src/lib.rs @@ -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