build.rs (461B)
1 use rustc_version::{version_meta, Channel}; 2 fn main() { 3 println!("cargo::rustc-check-cfg=cfg(channel_dev,channel_nightly,channel_beta,channel_stable)"); 4 println!( 5 "cargo::rustc-cfg=channel_{}", 6 match version_meta().map_or(Channel::Stable, |meta| meta.channel) { 7 Channel::Dev => "dev", 8 Channel::Nightly => "nightly", 9 Channel::Beta => "beta", 10 Channel::Stable => "stable", 11 } 12 ); 13 }