Merge rust-bitcoin/rust-bitcoin#1608: Set `rustv_1_53` in build script

bb612fdafa Set rustv_1_53 in build script (Tobin C. Harding)

Pull request description:

  The rust version is supposed to be set by the build script so that users automagically get features matching the toolchain in use. Currently we have a feature in the manifest for `rustv_1_53` instead setting a compiler conditional configuration option in the build script. This causes `cargo +1.41.1 --all-features check` to fail.

  ## Note

  I don't see `rustv_1_46` used anywhere, do we need that still?

ACKs for top commit:
  apoelstra:
    ACK bb612fdafa
  Kixunil:
    ACK bb612fdafa

Tree-SHA512: f74195d4ee5a5bc5f209e99d30789df3552cef10aee5ea8b61a5a701b753999c34d04be9fe0321ccee7a8ec14fa5a05e0b454b9dc5f8deddd7b5b8d4f3d7e744
This commit is contained in:
Andrew Poelstra 2023-02-06 14:00:15 +00:00
commit 12298ddc14
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
3 changed files with 4 additions and 5 deletions

View File

@ -21,7 +21,6 @@ serde = ["actual-serde", "bitcoin_hashes/serde", "secp256k1/serde"]
secp-lowmemory = ["secp256k1/lowmemory"]
secp-recovery = ["secp256k1/recovery"]
bitcoinconsensus-std = ["bitcoinconsensus/std", "std"]
rust_v_1_53 = []
# At least one of std, no-std must be enabled.
#

View File

@ -23,7 +23,7 @@ fn main() {
.parse::<u64>()
.expect("invalid Rust minor version");
for activate_version in &[46] {
for activate_version in &[46, 53] {
if minor >= *activate_version {
println!("cargo:rustc-cfg=rust_v_1_{}", activate_version);
}

View File

@ -59,7 +59,7 @@ use core::convert::TryFrom;
use core::borrow::{Borrow, BorrowMut};
use core::{fmt, default::Default};
use core::ops::{Deref, DerefMut, Index, Range, RangeFull, RangeFrom, RangeTo, RangeInclusive, RangeToInclusive};
#[cfg(feature = "rust_v_1_53")]
#[cfg(rust_v_1_53)]
use core::ops::Bound;
#[cfg(feature = "serde")] use serde;
@ -615,8 +615,8 @@ macro_rules! delegate_index {
}
delegate_index!(Range<usize>, RangeFrom<usize>, RangeTo<usize>, RangeFull, RangeInclusive<usize>, RangeToInclusive<usize>);
#[cfg(feature = "rust_v_1_53")]
#[cfg_attr(docsrs, doc(cfg(feature = "rust_v_1_53")))]
#[cfg(rust_v_1_53)]
#[cfg_attr(docsrs, doc(cfg(rust_v_1_53)))]
delegate_index!((Bound<usize>, Bound<usize>));
impl AsRef<Script> for Script {