]>
git.proxmox.com Git - rustc.git/blob - vendor/semver/build.rs
2 use std
::process
::Command
;
6 let compiler
= match rustc_minor_version() {
7 Some(compiler
) => compiler
,
12 // Exhaustive integer patterns. On older compilers, a final `_` arm is
13 // required even if every possible integer value is otherwise covered.
14 // https://github.com/rust-lang/rust/issues/50907
15 println
!("cargo:rustc-cfg=no_exhaustive_int_match");
19 // extern crate alloc.
20 // https://blog.rust-lang.org/2019/07/04/Rust-1.36.0.html#the-alloc-crate-is-stable
21 println
!("cargo:rustc-cfg=no_alloc_crate");
26 // https://doc.rust-lang.org/std/vec/struct.Vec.html#method.new
27 println
!("cargo:rustc-cfg=no_const_vec_new");
32 // https://blog.rust-lang.org/2019/12/19/Rust-1.40.0.html#non_exhaustive-structs-enums-and-variants
33 println
!("cargo:rustc-cfg=no_non_exhaustive");
37 // String::strip_prefix.
38 // https://doc.rust-lang.org/std/primitive.str.html#method.repeat
39 println
!("cargo:rustc-cfg=no_str_strip_prefix");
44 // https://blog.rust-lang.org/2020/08/27/Rust-1.46.0.html#track_caller
45 println
!("cargo:rustc-cfg=no_track_caller");
49 // #![deny(unsafe_op_in_unsafe_fn)].
50 // https://github.com/rust-lang/rust/issues/71668
51 println
!("cargo:rustc-cfg=no_unsafe_op_in_unsafe_fn_lint");
55 // Efficient intrinsics for count-leading-zeros and count-trailing-zeros
56 // on NonZero integers stabilized in 1.53.0. On many architectures these
57 // are more efficient than counting zeros on ordinary zeroable integers.
58 // https://doc.rust-lang.org/std/num/struct.NonZeroU64.html#method.leading_zeros
59 // https://doc.rust-lang.org/std/num/struct.NonZeroU64.html#method.trailing_zeros
60 println
!("cargo:rustc-cfg=no_nonzero_bitscan");
64 fn rustc_minor_version() -> Option
<u32> {
65 let rustc
= env
::var_os("RUSTC")?
;
66 let output
= Command
::new(rustc
).arg("--version").output().ok()?
;
67 let version
= str::from_utf8(&output
.stdout
).ok()?
;
68 let mut pieces
= version
.split('
.'
);
69 if pieces
.next() != Some("rustc 1") {
72 pieces
.next()?
.parse().ok()