build.rs (390B)
1 use rustc_version::{version_meta, Channel}; 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) 12 }