Skip to content

Commit 0539585

Browse files
committed
Raise MSRV to 1.51.0
In 8273b80 we (I) added a dep on `hex` which silently raised the MSRV of this branch to Rust 1.51.0 Because of how we test on this branch this was not caught by CI. The version with this change has been released for 2 years now and no-one has complained implying that no-one is building with Rust 1.41 Although it is a violation of semver, lets just bump the MSRV in a point release and live with the mistake. Includes removal of `unsigned_abs` since it is now available with this MSRV.
1 parent 9c66f90 commit 0539585

File tree

6 files changed

+18
-31
lines changed

6 files changed

+18
-31
lines changed

.github/workflows/rust.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,30 +61,30 @@ jobs:
6161
run: ./contrib/test.sh
6262

6363
MSRV:
64-
name: Test - 1.41.1 toolchain
64+
name: Test - 1.51.0 toolchain
6565
runs-on: ubuntu-latest
6666
strategy:
6767
fail-fast: false
6868
steps:
6969
- name: Checkout Crate
7070
uses: actions/checkout@v3
7171
- name: Checkout Toolchain
72-
uses: dtolnay/rust-toolchain@1.41.1
72+
uses: dtolnay/rust-toolchain@1.51.0
7373
- name: Running test script
7474
env:
7575
DO_FEATURE_MATRIX: true
7676
run: ./contrib/test.sh
7777

7878
NoStd:
79-
name: Test - 1.47 toolchain
79+
name: Test - 1.51.0 toolchain
8080
runs-on: ubuntu-latest
8181
strategy:
8282
fail-fast: false
8383
steps:
8484
- name: Checkout Crate
8585
uses: actions/checkout@v3
8686
- name: Checkout Toolchain
87-
uses: dtolnay/rust-toolchain@1.47
87+
uses: dtolnay/rust-toolchain@1.51.0
8888
- name: Running test script
8989
env:
9090
DO_NO_STD: true

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,11 @@ For more information please see `./CONTRIBUTING.md`.
7676

7777
## Minimum Supported Rust Version (MSRV)
7878

79-
This library should always compile with any combination of features (minus
80-
`no-std`) on **Rust 1.41.1** or **Rust 1.47** with `no-std`.
79+
This library should always compile with any combination of features on **Rust 1.51.0**.
8180

82-
To build with the MSRV you will need to pin some dependencies (also for `no-std`):
81+
To build with the MSRV you may need to pin some dependencies:
8382
```
84-
cargo update -p serde --precise 1.0.156
85-
cargo update -p syn --precise 1.0.107
83+
cargo update -p cc --precise 1.0.170
8684
```
8785

8886
## Installing Rust

bitcoin/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# 0.30.3 - 2025-12-09
2+
3+
- Bump the MSRV to Rust 1.51.0
4+
5+
Sorry, we accidentally did this 2 years ago in 0.30.2, since no-one
6+
complained we decided to keep it even though it is a semver violation.
7+
If you need to build with Rust 1.41 please pin to `v0.30.1`.
8+
19
# 0.30.2 - 2023-11-16
210

311
- Expose valid (min, max) difficulty transition thresholds [#1820](Expose valid (min, max) difficulty transition thresholds)

bitcoin/contrib/test.sh

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,6 @@ if cargo --version | grep beta; then
2323
STABLE=false
2424
fi
2525

26-
# Pin dependencies as required if we are using MSRV toolchain.
27-
if cargo --version | grep "1\.41"; then
28-
cargo update -p cc --precise 1.0.77
29-
# 1.0.157 uses syn 2.0 which requires edition 2018
30-
cargo update -p serde --precise 1.0.156
31-
32-
# latest arrayvec build fails because of `track_caller`.
33-
cargo update -p arrayvec --precise 0.7.2
34-
fi
35-
36-
# Pin dependencies as above (required for no-std tests that use Rust 1.47 toolchain).
37-
if cargo --version | grep "1\.47"; then
38-
cargo update -p serde --precise 1.0.156
39-
cargo update -p syn --precise 1.0.107
40-
fi
41-
4226
# We should not have any duplicate dependencies. This catches mistakes made upgrading dependencies
4327
# in one crate and not in another (e.g. upgrade bitcoin_hashes in bitcoin but not in secp).
4428
duplicate_dependencies=$(

bitcoin/src/amount.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ fn parse_signed_to_satoshi(
261261
// into a less precise amount. That is not allowed unless
262262
// there are no decimals and the last digits are zeroes as
263263
// many as the difference in precision.
264-
let last_n = unsigned_abs(precision_diff).into();
264+
let last_n = precision_diff.unsigned_abs().into();
265265
if is_too_precise(s, last_n) {
266266
match s.parse::<i64>() {
267267
Ok(0_i64) => return Ok((is_negative, 0)),
@@ -374,9 +374,6 @@ fn dec_width(mut num: u64) -> usize {
374374
width
375375
}
376376

377-
// NIH due to MSRV, impl copied from `core::i8::unsigned_abs` (introduced in Rust 1.51.1).
378-
fn unsigned_abs(x: i8) -> u8 { x.wrapping_abs() as u8 }
379-
380377
fn repeat_char(f: &mut dyn fmt::Write, c: char, count: usize) -> fmt::Result {
381378
for _ in 0..count {
382379
f.write_char(c)?;
@@ -410,7 +407,7 @@ fn fmt_satoshi_in(
410407
trailing_decimal_zeros = options.precision.unwrap_or(0);
411408
}
412409
Ordering::Less => {
413-
let precision = unsigned_abs(precision);
410+
let precision = precision.unsigned_abs();
414411
let divisor = 10u64.pow(precision.into());
415412
num_before_decimal_point = satoshi / divisor;
416413
num_after_decimal_point = satoshi % divisor;

clippy.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
msrv = "1.41.1"
1+
msrv = "1.51.1"

0 commit comments

Comments
 (0)