Bump MSRV to Rust version 1.56.1

Rust version 1.56.0 introduced edition 2021. Shortly afterwards, on
October 21 2021 Rust version 1.56.1 was released.

Debian stable is currently shipping `rustc 1.63.0`.

Our stated MSRV policy is: In Debian stable and at least 2 years old.

Therefore our MSRV policy is met by Rust version 1.56.1 and we can strat
to bump our MSRV org wide.

Start by bumping the `rust-bitcoin` and `hashes` MSRV to Rust 1.56.1,
includes:

- Update docs.
- Update CI and remove pinning.
- Update the build files and remove now stale cfg attributes rust_v_1_x
  for values less than the new MSRV.
- Use new `IntoIterator` for arrays so we no longer need to allocate a
  vector to iterate.

Links:

- https://blog.rust-lang.org/2021/11/01/Rust-1.56.1.html
- https://blog.rust-lang.org/2021/10/21/Rust-1.56.0.html
- https://packages.debian.org/stable/rust/rustc
This commit is contained in:
Tobin C. Harding 2023-11-14 15:13:38 +11:00
parent ba318f167a
commit d9cc724187
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
12 changed files with 21 additions and 46 deletions

View File

@ -66,7 +66,7 @@ jobs:
run: ./contrib/test.sh
MSRV:
name: Test - 1.48.0 toolchain
name: Test - 1.56.1 toolchain
runs-on: ubuntu-latest
strategy:
fail-fast: false
@ -76,7 +76,7 @@ jobs:
- name: Checkout Toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.48.0"
toolchain: "1.56.1"
- name: Running test script
env:
DO_FEATURE_MATRIX: true

View File

@ -12,7 +12,7 @@
<a href="https://github.com/rust-bitcoin/rust-bitcoin/blob/master/LICENSE"><img alt="CC0 1.0 Universal Licensed" src="https://img.shields.io/badge/license-CC0--1.0-blue.svg"/></a>
<a href="https://github.com/rust-bitcoin/rust-bitcoin/actions?query=workflow%3AContinuous%20integration"><img alt="CI Status" src="https://github.com/rust-bitcoin/rust-bitcoin/workflows/Continuous%20integration/badge.svg"></a>
<a href="https://docs.rs/bitcoin"><img alt="API Docs" src="https://img.shields.io/badge/docs.rs-bitcoin-green"/></a>
<a href="https://blog.rust-lang.org/2020/02/27/Rust-1.48.0.html"><img alt="Rustc Version 1.48.0+" src="https://img.shields.io/badge/rustc-1.48.0%2B-lightgrey.svg"/></a>
<a href="https://blog.rust-lang.org/2020/02/27/Rust-1.56.1.html"><img alt="Rustc Version 1.56.1+" src="https://img.shields.io/badge/rustc-1.56.1%2B-lightgrey.svg"/></a>
<a href="https://gnusha.org/bitcoin-rust/"><img alt="Chat on IRC" src="https://img.shields.io/badge/irc-%23bitcoin--rust%20on%20libera.chat-blue"></a>
<a href="https://github.com/model-checking/kani"><imp alt="kani" src="https://github.com/rust-bitcoin/rust-bitcoin/actions/workflows/kani.yaml/badge.svg"></a>
</p>
@ -69,7 +69,7 @@ For more information please see `./CONTRIBUTING.md`.
## Minimum Supported Rust Version (MSRV)
This library should always compile with any combination of features on **Rust 1.48.0**.
This library should always compile with any combination of features on **Rust 1.56.1**.
To build with the MSRV you will likely need to pin a bunch of dependencies, see `./contrib/test.sh`
for the current list.

View File

@ -1,3 +1,7 @@
# unreleased
- Bump MSRV to Rust 1.56.1
# 0.31.1 - 2023-10-18
- Bump MSRV to Rust 1.48.0 [#1729](https://github.com/rust-bitcoin/rust-bitcoin/pull/1729)

View File

@ -1,4 +1,4 @@
const MSRV_MINOR: u64 = 48;
const MSRV_MINOR: u64 = 56;
fn main() {
let rustc = std::env::var_os("RUSTC");

View File

@ -2,9 +2,9 @@
use core::convert::{TryFrom, TryInto};
use core::fmt;
#[cfg(rust_v_1_53)]
use core::ops::Bound;
use core::ops::{Index, Range, RangeFrom, RangeFull, RangeInclusive, RangeTo, RangeToInclusive};
use core::ops::{
Bound, Index, Range, RangeFrom, RangeFull, RangeInclusive, RangeTo, RangeToInclusive,
};
use hashes::Hash;
use secp256k1::{Secp256k1, Verification};
@ -653,7 +653,6 @@ delegate_index!(
RangeTo<usize>,
RangeFull,
RangeInclusive<usize>,
RangeToInclusive<usize>
RangeToInclusive<usize>,
(Bound<usize>, Bound<usize>)
);
#[cfg(rust_v_1_53)]
delegate_index!((Bound<usize>, Bound<usize>));

View File

@ -16,10 +16,8 @@ pub use self::primitive::*;
/// break invariants. Therefore auditing this module should be sufficient.
mod primitive {
use core::convert::{TryFrom, TryInto};
#[cfg(rust_v_1_53)]
use core::ops::Bound;
use core::ops::{
Index, Range, RangeFrom, RangeFull, RangeInclusive, RangeTo, RangeToInclusive,
Bound, Index, Range, RangeFrom, RangeFull, RangeInclusive, RangeTo, RangeToInclusive,
};
use super::PushBytesError;
@ -105,10 +103,9 @@ mod primitive {
RangeTo<usize>,
RangeFull,
RangeInclusive<usize>,
RangeToInclusive<usize>
RangeToInclusive<usize>,
(Bound<usize>, Bound<usize>)
);
#[cfg(rust_v_1_53)]
delegate_index!((Bound<usize>, Bound<usize>));
impl Index<usize> for PushBytes {
type Output = u8;

View File

@ -1845,7 +1845,7 @@ mod test {
let tree_info = builder.finalize(&secp, internal_key).unwrap();
let output_key = tree_info.output_key();
for script in vec![a, b, c, d, e] {
for script in [a, b, c, d, e] {
let ver_script = (script, LeafVersion::TapScript);
let ctrl_block = tree_info.control_block(&ver_script).unwrap();
assert!(ctrl_block.verify_taproot_commitment(

View File

@ -1,2 +1,2 @@
msrv = "1.48.0"
msrv = "1.56.1"
too-many-arguments-threshold = 13

View File

@ -4,22 +4,6 @@ set -ex
CRATES="bitcoin hashes internals fuzz"
DEPS="recent minimal"
MSRV="1\.48\.0"
# Test pinned versions.
if cargo --version | grep ${MSRV}; then
cargo update -p serde_json --precise 1.0.99
cargo update -p serde --precise 1.0.156
cargo update -p quote --precise 1.0.30
cargo update -p proc-macro2 --precise 1.0.63
cargo update -p serde_test --precise 1.0.175
cargo update -p schemars --precise 0.8.12
# byteorder 1.5.0 uses edition 2021
cargo update -p byteorder --precise 1.4.3
# Build MSRV with pinned versions.
cargo check --all-features --all-targets
fi
for dep in $DEPS
do

View File

@ -9,7 +9,7 @@ since these are needed to display hashes anway.
## Minimum Supported Rust Version (MSRV)
This library should always compile with any combination of features on **Rust 1.48.0**.
This library should always compile with any combination of features on **Rust 1.56.1**.
To build with the MSRV you will need to pin `serde` (if you have either the `serde` or the

View File

@ -1,4 +1,4 @@
const MSRV_MINOR: u64 = 48;
const MSRV_MINOR: u64 = 56;
fn main() {
let rustc = std::env::var_os("RUSTC");

View File

@ -47,7 +47,6 @@ mod impls {
})
}
#[cfg(rust_v_1_55)]
fn try_into_de_error<E>(self, expected: Option<&dyn de::Expected>) -> Result<E, Self>
where
E: de::Error,
@ -61,13 +60,5 @@ mod impls {
_ => Err(self),
}
}
#[cfg(not(rust_v_1_55))]
fn try_into_de_error<E>(self, _expected: Option<&dyn de::Expected>) -> Result<E, Self>
where
E: de::Error,
{
Err(self)
}
}
}