aboutsummaryrefslogtreecommitdiff
path: root/syn-mid/examples/const_fn_test/build.rs
blob: bebf234f4035309bb254a16120186cc3e320a96a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use std::{env, process::Command};

fn main() {
    println!("cargo:rerun-if-changed=build.rs");

    if is_nightly() {
        println!("cargo:rustc-cfg=nightly");
    }
}

fn is_nightly() -> bool {
    env::var_os("RUSTC")
        .and_then(|rustc| Command::new(rustc).arg("--version").output().ok())
        .and_then(|output| String::from_utf8(output.stdout).ok())
        .map_or(false, |version| version.contains("nightly"))
}