• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #![warn(rust_2018_idioms, single_use_lifetimes)]
2 
3 use std::{env, process::Command};
4 
main()5 fn main() {
6     if is_nightly() {
7         println!("cargo:rustc-cfg=nightly");
8     }
9 }
10 
is_nightly() -> bool11 fn is_nightly() -> bool {
12     env::var_os("RUSTC")
13         .and_then(|rustc| Command::new(rustc).arg("--version").output().ok())
14         .and_then(|output| String::from_utf8(output.stdout).ok())
15         .map_or(false, |version| version.contains("nightly") || version.contains("dev"))
16 }
17