Skip to content

Instantly share code, notes, and snippets.

@roustem
Created April 3, 2020 18:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roustem/aefc463fbbd2a02f13faf9152b6717bc to your computer and use it in GitHub Desktop.
Save roustem/aefc463fbbd2a02f13faf9152b6717bc to your computer and use it in GitHub Desktop.
extern crate rustc_version;
use rustc_version::{version_meta, Channel}
fn main() {
// Set cfg flags depending on release channel
match version_meta().unwrap().channel {
Channel::Stable => {
println!("cargo:rustc-cfg=rustc-stable");
}
Channel::Beta => {
println!("cargo:rustc-cfg=rustc-beta");
}
Channel::Nightly => {
println!("cargo:rustc-cfg=rustc-nightly");
}
Channel::Dev => {
println!("cargo:rustc-cfg=rustc-dev");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment