-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
5 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,15 @@ | ||
// https://stackoverflow.com/a/49250753/1290530 | ||
// Based on https://stackoverflow.com/a/49250753/1290530 | ||
|
||
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_IS_STABLE"); | ||
} | ||
Channel::Beta => { | ||
println!("cargo:rustc-cfg=RUSTC_IS_BETA"); | ||
} | ||
Channel::Nightly => { | ||
// Enable our feature on nightly, or when using a | ||
// locally build rustc | ||
Channel::Nightly | Channel::Dev => { | ||
println!("cargo:rustc-cfg=feature=\"RUSTC_IS_NIGHTLY\""); | ||
} | ||
Channel::Dev => { | ||
println!("cargo:rustc-cfg=RUSTC_IS_DEV"); | ||
} | ||
_ => {} | ||
} | ||
} |