Created
April 3, 2020 18:59
-
-
Save roustem/aefc463fbbd2a02f13faf9152b6717bc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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