From 69adf1de725fd1920d1013d0f122f107569f48af Mon Sep 17 00:00:00 2001 From: vados Date: Wed, 11 Sep 2024 14:24:42 +0900 Subject: [PATCH] fix(simple): cfg flag usage for nightly detection Signed-off-by: vados --- crates/async-dropper-simple/build.rs | 11 ++++++----- crates/async-dropper-simple/src/lib.rs | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) 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