Skip to content

Commit 87c554d

Browse files
committed
Bump MSRV to rustc 1.75.0
We generally align our MSRV with Debian's stable channel. Debian 13 'Trixie' was just released, shipping rustc 1.85. However, as 1.85.0 is only about ~7months old at this point, we opt to bump to the more conservative 1.75.0, which approaches two years of age.
1 parent 7f20d47 commit 87c554d

File tree

22 files changed

+55
-90
lines changed

22 files changed

+55
-90
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ jobs:
3131
fail-fast: false
3232
matrix:
3333
platform: [ self-hosted, windows-latest, macos-latest ]
34-
toolchain: [ stable, beta, 1.63.0 ] # 1.63.0 is the MSRV for all crates but `lightning-transaction-sync`.
34+
toolchain: [ stable, beta, 1.75.0 ] # 1.75.0 is the MSRV for all crates
3535
exclude:
3636
- platform: windows-latest
37-
toolchain: 1.63.0
37+
toolchain: 1.75.0
3838
- platform: windows-latest
3939
toolchain: beta
4040
- platform: macos-latest
@@ -60,7 +60,7 @@ jobs:
6060
shellcheck ci/*.sh -aP ci
6161
shellcheck contrib/*.sh -aP contrib
6262
- name: Set RUSTFLAGS to deny warnings
63-
if: "matrix.toolchain == '1.63.0'"
63+
if: "matrix.toolchain == '1.75.0'"
6464
run: echo "RUSTFLAGS=-D warnings" >> "$GITHUB_ENV"
6565
- name: Run CI script
6666
shell: bash # Default on Winblows is powershell
@@ -71,7 +71,7 @@ jobs:
7171
fail-fast: false
7272
matrix:
7373
platform: [ ubuntu-latest, macos-latest ]
74-
toolchain: [ stable, beta, 1.75.0 ] # 1.75.0 is the MSRV for `lightning-transaction-sync`.
74+
toolchain: [ stable, beta, 1.75.0 ]
7575
runs-on: ${{ matrix.platform }}
7676
steps:
7777
- name: Checkout source code
@@ -254,17 +254,13 @@ jobs:
254254
fuzz:
255255
runs-on: self-hosted
256256
env:
257-
TOOLCHAIN: 1.63
257+
TOOLCHAIN: 1.75
258258
steps:
259259
- name: Checkout source code
260260
uses: actions/checkout@v4
261261
- name: Install Rust ${{ env.TOOLCHAIN }} toolchain
262262
run: |
263263
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain ${{ env.TOOLCHAIN }}
264-
- name: Pin the regex dependency
265-
run: |
266-
cd fuzz && cargo update -p regex --precise "1.9.6" --verbose
267-
cd write-seeds && cargo update -p regex --precise "1.9.6" --verbose
268264
- name: Sanity check fuzz targets on Rust ${{ env.TOOLCHAIN }}
269265
run: |
270266
cd fuzz
@@ -293,7 +289,7 @@ jobs:
293289
rustfmt:
294290
runs-on: ubuntu-latest
295291
env:
296-
TOOLCHAIN: 1.63.0
292+
TOOLCHAIN: 1.75.0
297293
steps:
298294
- name: Checkout source code
299295
uses: actions/checkout@v4

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ be covered by functional tests.
8888
When refactoring, structure your PR to make it easy to review and don't
8989
hesitate to split it into multiple small, focused PRs.
9090

91-
The Minimum Supported Rust Version (MSRV) currently is 1.63.0 (enforced by
91+
The Minimum Supported Rust Version (MSRV) currently is 1.75.0 (enforced by
9292
our GitHub Actions). We support reading serialized LDK objects written by any
9393
version of LDK 0.0.99 and above. We support LDK versions 0.0.113 and above
9494
reading serialized LDK objects written by modern LDK. Any expected issues with
@@ -124,7 +124,7 @@ display fine at any tab-length display setting. We use `rustfmt` to establish
124124
uniform coding standards throughout the codebase. Please run
125125

126126
```bash
127-
cargo +1.63.0 fmt
127+
cargo +1.75.0 fmt
128128
```
129129

130130
before committing and pushing any changes, as compliance will also be checked

ci/check-lint.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ CLIPPY() {
4747
-A clippy::len_without_is_empty \
4848
-A clippy::len_zero \
4949
-A clippy::let_and_return \
50-
-A clippy::manual_div_ceil `# to be removed once we hit MSRV 1.73.0` \
5150
-A clippy::manual_filter \
5251
-A clippy::manual_map \
5352
-A clippy::manual_memcpy \
@@ -106,9 +105,7 @@ CLIPPY() {
106105
-A clippy::unnecessary_unwrap \
107106
-A clippy::unused_unit \
108107
-A clippy::useless_conversion \
109-
-A clippy::unnecessary_map_or `# to be removed once we hit MSRV 1.70` \
110108
-A clippy::manual_repeat_n `# to be removed once we hit MSRV 1.86` \
111-
-A clippy::io_other_error `# to be removed once we hit MSRV 1.74` \
112109
-A clippy::manual_is_multiple_of `# to be removed once we hit MSRV 1.87` \
113110
-A clippy::uninlined-format-args
114111
}

ci/ci-tests.sh

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,20 @@
22
#shellcheck disable=SC2002,SC2207
33
set -eox pipefail
44

5-
RUSTC_MINOR_VERSION=$(rustc --version | awk '{ split($2,a,"."); print a[2] }')
5+
# Currently unused as we don't have to pin anything for MSRV:
6+
#RUSTC_MINOR_VERSION=$(rustc --version | awk '{ split($2,a,"."); print a[2] }')
67

78
# Some crates require pinning to meet our MSRV even for our downstream users,
89
# which we do here.
910
# Further crates which appear only as dev-dependencies are pinned further down.
1011
function PIN_RELEASE_DEPS {
11-
# Starting with version 1.39.0, the `tokio` crate has an MSRV of rustc 1.70.0
12-
[ "$RUSTC_MINOR_VERSION" -lt 70 ] && cargo update -p tokio --precise "1.38.1" --verbose
13-
1412
return 0 # Don't fail the script if our rustc is higher than the last check
1513
}
1614

1715
PIN_RELEASE_DEPS # pin the release dependencies in our main workspace
1816

19-
# Starting with version 1.10.0, the `regex` crate has an MSRV of rustc 1.65.0.
20-
[ "$RUSTC_MINOR_VERSION" -lt 65 ] && cargo update -p regex --precise "1.9.6" --verbose
21-
22-
# The addr2line v0.21 crate (a dependency of `backtrace` starting with 0.3.69) relies on rustc 1.65
23-
[ "$RUSTC_MINOR_VERSION" -lt 65 ] && cargo update -p backtrace --precise "0.3.68" --verbose
24-
25-
# The once_cell v1.21.0 crate (a dependency of `proptest`) relies on rustc 1.70
26-
[ "$RUSTC_MINOR_VERSION" -lt 70 ] && cargo update -p once_cell --precise "1.20.3" --verbose
27-
28-
# proptest 1.3.0 requires rustc 1.64.0
29-
[ "$RUSTC_MINOR_VERSION" -lt 64 ] && cargo update -p proptest --precise "1.2.0" --verbose
30-
31-
# parking_lot 0.12.4 requires rustc 1.64.0
32-
[ "$RUSTC_MINOR_VERSION" -lt 64 ] && cargo update -p parking_lot --precise "0.12.3" --verbose
33-
34-
# parking_lot_core 0.9.11 requires rustc 1.64.0
35-
[ "$RUSTC_MINOR_VERSION" -lt 64 ] && cargo update -p parking_lot_core --precise "0.9.10" --verbose
36-
37-
# lock_api 0.4.13 requires rustc 1.64.0
38-
[ "$RUSTC_MINOR_VERSION" -lt 64 ] && cargo update -p lock_api --precise "0.4.12" --verbose
17+
# The backtrace v0.3.75 crate relies on rustc 1.82
18+
[ "$RUSTC_MINOR_VERSION" -lt 82 ] && cargo update -p backtrace --precise "0.3.74" --verbose
3919

4020
export RUST_BACKTRACE=1
4121

@@ -49,7 +29,6 @@ cargo test --verbose --color always
4929

5030
echo -e "\n\nTesting upgrade from prior versions of LDK"
5131
pushd lightning-tests
52-
[ "$RUSTC_MINOR_VERSION" -lt 65 ] && cargo update -p regex --precise "1.9.6" --verbose
5332
cargo test
5433
popd
5534

lightning-invoice/src/de.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ impl FromBase32 for Bolt11InvoiceFeatures {
102102
// Carry bits, 0, 1, 2, 3, or 4 bits
103103
let mut carry_bits = 0;
104104
let mut carry = 0u8;
105-
let expected_raw_length = (field_data.len() * 5 + 7) / 8;
105+
let expected_raw_length = (field_data.len() * 5).div_ceil(8);
106106
let mut output = Vec::<u8>::with_capacity(expected_raw_length);
107107

108108
// Iterate over input in reverse

lightning-invoice/src/ser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ fn encode_int_be_base32(int: u64) -> impl ExactSizeIterator<Item = Fe32> {
237237
/// The length of the output of `encode_int_be_base32`.
238238
fn encoded_int_be_base32_size(int: u64) -> usize {
239239
let bit_len = 64 - int.leading_zeros() as usize; // cast ok as value is in 0..=64.
240-
(bit_len + 4) / 5
240+
bit_len.div_ceil(5)
241241
}
242242

243243
impl Base32Iterable for RawDataPart {

lightning-liquidity/src/lsps2/service.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ where
781781
/// Returns whether the peer has any active LSPS2 requests.
782782
pub(crate) fn has_active_requests(&self, counterparty_node_id: &PublicKey) -> bool {
783783
let outer_state_lock = self.per_peer_state.read().unwrap();
784-
outer_state_lock.get(counterparty_node_id).map_or(false, |inner| {
784+
outer_state_lock.get(counterparty_node_id).is_some_and(|inner| {
785785
let peer_state = inner.lock().unwrap();
786786
!peer_state.outbound_channels_by_intercept_scid.is_empty()
787787
})

lightning-liquidity/src/lsps5/service.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ where
596596
// (other than lsps5.webhook_registered) close in time.
597597
if notification.method != WebhookNotificationMethod::LSPS5WebhookRegistered {
598598
let rate_limit_applies = peer_state.webhooks().iter().any(|(_, webhook)| {
599-
webhook.last_notification_sent.as_ref().map_or(false, |last_sent| {
599+
webhook.last_notification_sent.as_ref().is_some_and(|last_sent| {
600600
now.duration_since(&last_sent) < NOTIFICATION_COOLDOWN_TIME
601601
})
602602
});

lightning-liquidity/src/manager.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -770,12 +770,12 @@ where
770770
let lsps2_has_active_requests = self
771771
.lsps2_service_handler
772772
.as_ref()
773-
.map_or(false, |h| h.has_active_requests(sender_node_id));
773+
.is_some_and(|h| h.has_active_requests(sender_node_id));
774774
#[cfg(lsps1_service)]
775775
let lsps1_has_active_requests = self
776776
.lsps1_service_handler
777777
.as_ref()
778-
.map_or(false, |h| h.has_active_requests(sender_node_id));
778+
.is_some_and(|h| h.has_active_requests(sender_node_id));
779779
#[cfg(not(lsps1_service))]
780780
let lsps1_has_active_requests = false;
781781

@@ -918,7 +918,7 @@ where
918918
fn provided_node_features(&self) -> NodeFeatures {
919919
let mut features = NodeFeatures::empty();
920920

921-
let advertise_service = self.service_config.as_ref().map_or(false, |c| c.advertise_service);
921+
let advertise_service = self.service_config.as_ref().is_some_and(|c| c.advertise_service);
922922

923923
if advertise_service {
924924
features
@@ -932,7 +932,7 @@ where
932932
fn provided_init_features(&self, _their_node_id: PublicKey) -> InitFeatures {
933933
let mut features = InitFeatures::empty();
934934

935-
let advertise_service = self.service_config.as_ref().map_or(false, |c| c.advertise_service);
935+
let advertise_service = self.service_config.as_ref().is_some_and(|c| c.advertise_service);
936936
if advertise_service {
937937
features
938938
.set_optional_custom_bit(LSPS_FEATURE_BIT)

lightning-persister/src/utils.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub(crate) fn check_namespace_key_validity(
2626
PrintableString(secondary_namespace),
2727
PrintableString(key)
2828
);
29-
return Err(std::io::Error::new(std::io::ErrorKind::Other, msg));
29+
return Err(std::io::Error::other(msg));
3030
}
3131

3232
if primary_namespace.is_empty() && !secondary_namespace.is_empty() {
@@ -37,7 +37,7 @@ pub(crate) fn check_namespace_key_validity(
3737
let msg = format!(
3838
"Failed to {} {}/{}/{}: primary namespace may not be empty if a non-empty secondary namespace is given.", operation,
3939
PrintableString(primary_namespace), PrintableString(secondary_namespace), PrintableString(key));
40-
return Err(std::io::Error::new(std::io::ErrorKind::Other, msg));
40+
return Err(std::io::Error::other(msg));
4141
}
4242

4343
if !is_valid_kvstore_str(primary_namespace)
@@ -50,7 +50,7 @@ pub(crate) fn check_namespace_key_validity(
5050
let msg = format!("Failed to {} {}/{}/{}: primary namespace, secondary namespace, and key must be valid.",
5151
operation,
5252
PrintableString(primary_namespace), PrintableString(secondary_namespace), PrintableString(key));
53-
return Err(std::io::Error::new(std::io::ErrorKind::Other, msg));
53+
return Err(std::io::Error::other(msg));
5454
}
5555
} else {
5656
if primary_namespace.is_empty() && !secondary_namespace.is_empty() {
@@ -60,7 +60,7 @@ pub(crate) fn check_namespace_key_validity(
6060
let msg = format!(
6161
"Failed to {} {}/{}: primary namespace may not be empty if a non-empty secondary namespace is given.",
6262
operation, PrintableString(primary_namespace), PrintableString(secondary_namespace));
63-
return Err(std::io::Error::new(std::io::ErrorKind::Other, msg));
63+
return Err(std::io::Error::other(msg));
6464
}
6565
if !is_valid_kvstore_str(primary_namespace) || !is_valid_kvstore_str(secondary_namespace) {
6666
debug_assert!(
@@ -76,7 +76,7 @@ pub(crate) fn check_namespace_key_validity(
7676
PrintableString(primary_namespace),
7777
PrintableString(secondary_namespace)
7878
);
79-
return Err(std::io::Error::new(std::io::ErrorKind::Other, msg));
79+
return Err(std::io::Error::other(msg));
8080
}
8181
}
8282

0 commit comments

Comments
 (0)