]>
git.proxmox.com Git - rustc.git/blob - vendor/serde_derive/build.rs
2 use std
::process
::Command
;
5 // The rustc-cfg strings below are *not* public API. Please let us know by
6 // opening a GitHub issue if your build environment requires some way to enable
7 // these cfgs other than by executing our build script.
9 let minor
= match rustc_minor_version() {
14 // Underscore const names stabilized in Rust 1.37:
15 // https://blog.rust-lang.org/2019/08/15/Rust-1.37.0.html#using-unnamed-const-items-for-macros
17 println
!("cargo:rustc-cfg=underscore_consts");
20 // The ptr::addr_of! macro stabilized in Rust 1.51:
21 // https://blog.rust-lang.org/2021/03/25/Rust-1.51.0.html#stabilized-apis
23 println
!("cargo:rustc-cfg=ptr_addr_of");
27 fn rustc_minor_version() -> Option
<u32> {
28 let rustc
= env
::var_os("RUSTC")?
;
29 let output
= Command
::new(rustc
).arg("--version").output().ok()?
;
30 let version
= str::from_utf8(&output
.stdout
).ok()?
;
31 let mut pieces
= version
.split('
.'
);
32 if pieces
.next() != Some("rustc 1") {
35 pieces
.next()?
.parse().ok()