use rustc::Channel; use rustc_version as rustc; fn main() { let target_version = rustc::version_meta().expect("failed to get version"); match target_version.channel { Channel::Nightly | Channel::Beta | Channel::Dev => println!("cargo::rustc-cfg=feature=\"nightly\""), _ => () } }