Skip to content

Bump MSRV to Rust version 1.56.1#2188

Merged
apoelstra merged 4 commits intorust-bitcoin:masterfrom
tcharding:11-14-bump-msrv
Nov 26, 2023
Merged

Bump MSRV to Rust version 1.56.1#2188
apoelstra merged 4 commits intorust-bitcoin:masterfrom
tcharding:11-14-bump-msrv

Conversation

@tcharding
Copy link
Copy Markdown
Member

@tcharding tcharding commented Nov 14, 2023

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

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:

@tcharding tcharding mentioned this pull request Nov 14, 2023
Copy link
Copy Markdown
Collaborator

@Kixunil Kixunil left a comment

Choose a reason for hiding this comment

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

While technically correct, it keeps MSRV_MINOR at 48 in build.rs. It might be nicer to bump it and remove #[cfg(rust_*)] for versions less than or equal to 1.56.

Further, this version stabilized the rust-version field in Cargo.toml and we should set it. It might reduce the burden of bumping the numbers in the future if we can pull them from that field. The release notes of Rust 1.56 specifically say "we encourage CI systems
that support Rust code to include a crate's specified minimum version in the test matrix for that crate by default." but I didn't check if our CI supports it.

I think doing these makes sense in this PR but wouldn't block it.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Oh, yeah, IntoIterator in arrays! 🎉 🎉 🎉

@tcharding tcharding force-pushed the 11-14-bump-msrv branch 3 times, most recently from c084746 to e729589 Compare November 14, 2023 22:03
@tcharding
Copy link
Copy Markdown
Member Author

Implemented suggestions and squashed it all into a single patch, re-wrote git log and PR description to match new patch.

Kixunil
Kixunil previously approved these changes Nov 14, 2023
Copy link
Copy Markdown
Collaborator

@Kixunil Kixunil left a comment

Choose a reason for hiding this comment

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

ACK e729589955bb2b39c5178f255fdd40c3b68b46ee

@tcharding
Copy link
Copy Markdown
Member Author

Oh, sorry man was working while you reviewed. I added a patch to update to edition 2021.

Kixunil
Kixunil previously approved these changes Nov 14, 2023
Copy link
Copy Markdown
Collaborator

@Kixunil Kixunil left a comment

Choose a reason for hiding this comment

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

ACK 4ab2c2889630a150bd02328623af2218a36d5aa5

@Kixunil
Copy link
Copy Markdown
Collaborator

Kixunil commented Nov 14, 2023

Oh, I just notice you didn't set rust-version in Cargo.toml. Was it on purpose?

@tcharding
Copy link
Copy Markdown
Member Author

Not on purpose, just an omission on my part. Will add

Kixunil
Kixunil previously approved these changes Nov 15, 2023
Copy link
Copy Markdown
Collaborator

@Kixunil Kixunil left a comment

Choose a reason for hiding this comment

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

ACK 5afcc2b8d5cb6453eb680cc8b6f2cacc4667ede4

@apoelstra
Copy link
Copy Markdown
Member

cc @TheBlueMatt @stevenroose I'll give you two a week to comment or veto this, or else I'll merge it on Wednesday Nov 22.

apoelstra
apoelstra previously approved these changes Nov 15, 2023
Copy link
Copy Markdown
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ACK 5afcc2b8d5cb6453eb680cc8b6f2cacc4667ede4

@TheBlueMatt
Copy link
Copy Markdown
Member

Any chance we could delay this for a month or so? We're waiting on one user to confirm that our bump beyond 1.48 didn't break their platform due to the implied glibc bump that came with it.

@apoelstra
Copy link
Copy Markdown
Member

@TheBlueMatt yep, for sure. We're in no particular rush.

@Kixunil
Copy link
Copy Markdown
Collaborator

Kixunil commented Nov 15, 2023

Well it won't be released right now anyway so it shouldn't matter? Or is that user using our master branch?

@TheBlueMatt
Copy link
Copy Markdown
Member

Right, my point was more that its possible it will break that users' platform, and in that case we'd be back to square one and would have to consider whether this makes sense or what approach we'd take to upgrade past 1.48.

@TheBlueMatt
Copy link
Copy Markdown
Member

We've confirmed we're good to go. LDK will be bumping to 1.63 soon (lightningdevkit/rust-lightning#2681) so this can go ahead whenever.

@tcharding tcharding dismissed stale reviews from apoelstra and Kixunil via dda8765 November 22, 2023 03:08
@tcharding
Copy link
Copy Markdown
Member Author

Thanks man! Rebased.

Copy link
Copy Markdown
Contributor

@vincenzopalazzo vincenzopalazzo left a comment

Choose a reason for hiding this comment

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

ACK dda8765

@apoelstra
Copy link
Copy Markdown
Member

Might as well do it now then, since we don't have a major release planned til April.

apoelstra
apoelstra previously approved these changes Nov 22, 2023
Copy link
Copy Markdown
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ACK dda8765827e6d8807f4cac8e5186a20348718d64

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
We just bumped the MSRV to Rust 1.56.1 which includes edition 2021.

Update all crates in this repo to use edition 2021 and build/lint
warnings.
Add `rust-version = 1.56.1` to all crates in the workspace i.e.,
including `fuzz` but excluding the various test crates.
@tcharding
Copy link
Copy Markdown
Member Author

Rebased, no other changes.

apoelstra
apoelstra previously approved these changes Nov 22, 2023
Copy link
Copy Markdown
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ACK dda8765827e6d8807f4cac8e5186a20348718d64

Kixunil
Kixunil previously approved these changes Nov 23, 2023
Copy link
Copy Markdown
Collaborator

@Kixunil Kixunil left a comment

Choose a reason for hiding this comment

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

ACK 4d5415f

@@ -1,5 +1,6 @@
[workspace]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We should be able to remove all use statements importing TryFrom and TryInto now. Fine to do in as separate PR.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Unusualy, clippy told me about a few instances of TryInto but all of them. And none of the TryFrom. I opened some files to play with clippy and ended up just doing the patch to remove them all. Its on top.

Now that MSRV is Rust 1.56.1 we no longer need to explicitly import
`TryFrom` and `TryInto`.

No clue why clippy didn't find these for us.
@tcharding tcharding dismissed stale reviews from Kixunil and apoelstra via 761de88 November 23, 2023 16:53
Copy link
Copy Markdown
Collaborator

@Kixunil Kixunil left a comment

Choose a reason for hiding this comment

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

ACK 761de88

Copy link
Copy Markdown
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ACK 761de88

MSRV="1\.48\.0"

# Test pinned versions.
if cargo --version | grep ${MSRV}; then
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice!

Copy link
Copy Markdown
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ACK 761de88

@apoelstra apoelstra merged commit 4806461 into rust-bitcoin:master Nov 26, 2023
@tcharding tcharding deleted the 11-14-bump-msrv branch November 27, 2023 22:16
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.

6 participants