summaryrefslogtreecommitdiffstats
path: root/vendor/field-offset/build.rs
blob: a2f7a035391524177ff8c2a7a80a48b134612f92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
extern crate rustc_version;
use rustc_version::{version, version_meta, Channel, Version};

fn main() {
    // Assert we haven't travelled back in time
    assert!(version().unwrap().major >= 1);

    // Check for a minimum version
    if version().unwrap() >= Version::parse("1.36.0").unwrap() {
        println!("cargo:rustc-cfg=fieldoffset_maybe_uninit");
        println!("cargo:rustc-cfg=fieldoffset_has_alloc");
    }

    if version_meta().unwrap().channel == Channel::Nightly {
        println!("cargo:rustc-cfg=fieldoffset_assert_in_const_fn");
    }
}