Skip to content

Bump MSRV to 1.85.0 and rust edition to 2024#4602

Open
tnull wants to merge 16 commits intolightningdevkit:mainfrom
tnull:2026-05-bump-msrv-to-1.85
Open

Bump MSRV to 1.85.0 and rust edition to 2024#4602
tnull wants to merge 16 commits intolightningdevkit:mainfrom
tnull:2026-05-bump-msrv-to-1.85

Conversation

@tnull
Copy link
Copy Markdown
Contributor

@tnull tnull commented May 7, 2026

We previously decided on bumping the MSRV to the latest version Debian 13 'trixie' provides (1.85.0). As previously discussed (offline, but also on #4002) we however decided to defer that until after the release of Ubuntu 26.04 LTS as the prior Ubuntu LTS version didn't provide packages for rustc 1.85+. Now Ubuntu 26.04 is almost out for a month and we're free to finally bump the MSRV to 1.85.0.

This not only allows us to clean up the codebase and quite a few workarounds that were previously blocked on the Rust version, but also aligns the MSRV across LDK, LDK Node, and LDK Server (the latter have been on 1.85.0 for a while).

tnull added 16 commits May 7, 2026 14:01
The workspace now requires `rustc` 1.85.0 across manifests, CI,
docs, and the pending changelog entry. This keeps contributor and CI
expectations aligned with the toolchain needed by the rest of this PR.

Code and lint configuration are adjusted where 1.85 reports new
diagnostics so the raised MSRV builds cleanly.

Co-Authored-By: HAL 9000
The old pins only existed to keep `rustc` 1.75 builds working. With
the workspace MSRV raised, the normal dependency graph can move
forward without carrying those compatibility constraints.

Co-Authored-By: HAL 9000
`rustc` 1.85 no longer needs the crate-level test allowances that
guarded older diagnostics. Removing the allowances lets the test code
follow the normal lint policy under the new MSRV.

Co-Authored-By: HAL 9000
`Iterator::is_sorted_by_key` is available with the raised MSRV. The
validation behavior stays the same while block source initialization
avoids a local manual ordering check.

Co-Authored-By: HAL 9000
`Option::take_if` is available with the raised MSRV. Monitor cleanup
still removes only matching alternative funding entries, while the
condition and removal stay together.

Co-Authored-By: HAL 9000
`Result::inspect_err` is available with the raised MSRV. Channel logic
still records the same shutdown action before returning the error,
with the side effect tied to the failing result.

Co-Authored-By: HAL 9000
`slice::chunk_by` is available with the raised MSRV. Forward processing
keeps grouping contiguous entries by node id without maintaining an
explicit chunk cursor.

Co-Authored-By: HAL 9000
The onion packet size is fixed by the message format. Keeping packet
bytes in arrays preserves that invariant directly and avoids heap
backed vectors where the length cannot vary.

Co-Authored-By: HAL 9000
`Waker::noop` is available with the raised MSRV. Shared polling sites
no longer need a local dummy waker helper just to drive futures that
do not depend on wakeups.

Co-Authored-By: HAL 9000
`Waker::noop` is available with the raised MSRV. Background processing
can poll persistence futures without carrying its local dummy waker
helper.

Co-Authored-By: HAL 9000
The background processor no longer needs boxed futures for persistence
polling under the new MSRV. Keeping them pinned on the stack avoids
unnecessary allocation while preserving polling order.

Co-Authored-By: HAL 9000
Async closures are available with the raised MSRV. Background event
paths can express their deferred work directly without the wrapper
future pattern that was only needed for older compilers.

Co-Authored-By: HAL 9000
`Option::take` for `NonZero` types is available under the new MSRV.
The comment no longer describes an active limitation, so keeping it
would mislead future cleanup work.

Co-Authored-By: HAL 9000
The MSRV bump makes the 2024 edition available to all workspace
crates. Updating the manifests now keeps the codebase on the current
edition and applies the required compatibility fixes in production,
test, and fuzz targets.

This commit leaves the broad formatting churn to the following
`rustfmt` commit so the compatibility changes remain reviewable.

Co-Authored-By: HAL 9000
The edition migration changes `rustfmt` output across the workspace.
Keeping the formatting-only delta separate leaves the preceding commit
focused on manifest and compatibility changes.

Co-Authored-By: HAL 9000
The persister comment claimed the boxed future could be dropped after
Rust 2024. That is not accurate on `rustc` 1.85 because precise
captures are still unavailable for `impl Trait` in trait methods.

Removing the note avoids pointing future work at an unsupported
change.

Co-Authored-By: HAL 9000
@ldk-reviews-bot
Copy link
Copy Markdown

ldk-reviews-bot commented May 7, 2026

I've assigned @tankyleo as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@ldk-reviews-bot ldk-reviews-bot requested a review from tankyleo May 7, 2026 12:44
Comment thread ci/ci-tests-common.sh
@ldk-claude-review-bot
Copy link
Copy Markdown
Collaborator

Review Summary

This is a clean, comprehensive MSRV bump (1.75 -> 1.85) and Rust edition migration (2021 -> 2024). All 23 workspace crates are consistently updated. The substantive code changes are limited to:

  • #[no_mangle] -> #[unsafe(no_mangle)] across all fuzz targets (correct for Rust 2024)
  • Async closure syntax in lightning-background-processor (correct — captures are all shared references, closure is Copy, used correctly across three process_pending_events_async calls)
  • Match ergonomics fix in lightning-macros skip_legacy_fields! (correct — inserts *self dereference so explicit ref patterns compile under Rust 2024)
  • criterion bump 0.4 -> 0.5 (enabling removal of the RUSTSEC-2021-0145 atty advisory ignore)
  • Removal of now-unnecessary dependency pins in CI (backtrace, idna_adapter, hyper-rustls)

No bugs, security issues, or logic errors found.

Inline comments posted:

  • ci/ci-tests-common.sh:6-13 — Stale comments describing pinning behavior that no longer exists in the now-empty PIN_RELEASE_DEPS function.

Copy link
Copy Markdown
Contributor

@joostjager joostjager left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great to see the MSRV bump. If LDK Node and LDK Server are already on 1.85, and the vast majority of users consume rust-lightning through those projects, I do not see much value in holding rust-lightning back.

I am less sure about bundling all of the cleanup and edition-driven code changes into the same PR. That adds review and regression risk, similar to the rustfmt-style reformatting projects we have had in the past, and also makes this harder to get merged. I think it would be better to keep this as an MSRV-only bump first, then do the code cleanups opportunistically when touching those areas in the future.

@joostjager
Copy link
Copy Markdown
Contributor

We also get rid of the annoying cargo lock file conflicts

@TheBlueMatt
Copy link
Copy Markdown
Collaborator

TheBlueMatt commented May 7, 2026

IIRC we previously discussed holding off until 0.3 as well, otherwise we're bumping from 1.63 to 1.85 in one release which seems excessive. Would have been kinda nice to do the same in LDK Node.

@tnull
Copy link
Copy Markdown
Contributor Author

tnull commented May 7, 2026

I am less sure about bundling all of the cleanup and edition-driven code changes into the same PR. That adds review and regression risk, similar to the rustfmt-style reformatting projects we have had in the past, and also makes this harder to get merged. I think it would be better to keep this as an MSRV-only bump first, then do the code cleanups opportunistically when touching those areas in the future.

Well, I made sure to split-out the rustfmt related changes in particular so they can be easily reproduced. The vast majority of the remaining diff are mechanical changes that should be easily reviewable, there are only a few other 'real' cleanups/logic changes. Also note that there were a few places that still mentioned way smaller rust versions, i.e., it seems we never tend to actually clean these up 'opportunistically'.

@tnull
Copy link
Copy Markdown
Contributor Author

tnull commented May 7, 2026

IIRC we previously discussed holding off until 0.3 as well, otherwise we're bumping from 1.63 to 1.85 in one release which seems excessive.

Okay, but that is around the corner, no? Happy to rebase so we can get this out of the way first thing after we branch off 0.3-beta.

Would have been kinda nice to do the same in LDK Node.

Well, we won't have two bumps in one release there, as v0.7.0 already bumped to v1.85.0.

@TheBlueMatt
Copy link
Copy Markdown
Collaborator

Oh yea, sheesh that diff is huge. What causes rustfmt to want to change everything? Can we leave the old edition and ignore it (is there anything in the edition that we want?). Its also not clear to me that this is worth much - the only change that's actually a nice improvement seems to be the dropping of a few Boxes in the async BP code?

@codecov
Copy link
Copy Markdown

codecov Bot commented May 7, 2026

Codecov Report

❌ Patch coverage is 63.35196% with 656 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.84%. Comparing base (1d36f7b) to head (4025ed8).
⚠️ Report is 33 commits behind head on main.

Files with missing lines Patch % Lines
lightning/src/ln/peer_handler.rs 4.91% 232 Missing ⚠️
lightning/src/ln/channelmanager.rs 65.06% 78 Missing and 2 partials ⚠️
lightning-background-processor/src/lib.rs 47.70% 55 Missing and 2 partials ⚠️
lightning-liquidity/src/manager.rs 5.08% 56 Missing ⚠️
lightning-liquidity/src/lsps0/ser.rs 0.00% 27 Missing ⚠️
lightning-invoice/src/lib.rs 31.03% 20 Missing ⚠️
lightning-liquidity/src/lsps2/service.rs 23.07% 20 Missing ⚠️
lightning-persister/src/utils.rs 21.73% 18 Missing ⚠️
lightning/src/chain/channelmonitor.rs 43.33% 14 Missing and 3 partials ⚠️
lightning-liquidity/src/lsps2/client.rs 0.00% 15 Missing ⚠️
... and 25 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4602      +/-   ##
==========================================
- Coverage   86.16%   85.84%   -0.32%     
==========================================
  Files         156      157       +1     
  Lines      108669   109418     +749     
  Branches   108669   109418     +749     
==========================================
+ Hits        93638    93934     +296     
- Misses      12420    12864     +444     
- Partials     2611     2620       +9     
Flag Coverage Δ
tests 85.84% <63.35%> (-0.32%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@joostjager
Copy link
Copy Markdown
Contributor

Also note that there were a few places that still mentioned way smaller rust versions, i.e., it seems we never tend to actually clean these up 'opportunistically'.

Obviously you don't see the places where things were cleaned up. Or where code was cleaned without comments. Not sure if looking at what remains is a strong signal.

But even if we don't clean up, I don't think it is a big deal. At least someone could if they wanted too. And new code can make use of the larger feature set.

For me, the gain would mostly be to get rid of that annoying lock file conflict. On macos, libfuzzer needs nightly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants