The Openapi® Rust SDK moves to the Rust 2024 edition #86
francescobianco
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
The Openapi® Rust SDK now targets the Rust 2024 edition, with a declared minimum supported Rust version (MSRV) of 1.85. The change landed in #14, contributed by @LucaCappelletti94, and it's the first step in a series aimed at hardening the crate's CI and test suite before any new features go in.
Thank you, Luca! 🙏 This is the kind of groundwork that rarely makes headlines, but everything that comes after depends on it.
What changed
20212024rust-version = "1.85"Cargo.lock.gitignore, stale, broken on nightlycargo auditreqwestWhy Rust 2024 matters
Rust 2024 shipped with Rust 1.85 and is the biggest edition since 2018. For an async HTTP client like this SDK, several of its changes are directly useful:
FutureandIntoFuturein the prelude. Async code reads cleaner, with no extra imports to writeimpl Future<Output = …>signatures.impl Traitlifetimes. Return-positionimpl Traitnow captures in-scope lifetimes by default, anduse<..>gives precise control when you need it. This removes a whole family of confusing borrow errors in async and iterator-returning APIs.if letconditions and block tail expressions are dropped earlier. That closes a classic trap where a lock guard orRefCellborrow lived longer than expected and caused deadlocks or panics.unsafe.unsafe externblocks,#[unsafe(...)]attributes,unsafe_op_in_unsafe_fnwarning by default, and references tostatic mutdenied. The SDK doesn't rely onunsafe, and the edition makes it harder for any to slip in unnoticed.rust-version. Together with the newrust-version = "1.85", this keepscargo updatefrom silently pulling in crates that need a newer compiler than we support.genkeyword is reserved for future generators, and 1.85 also stabilized async closures, so the SDK can adopt them later without another toolchain bump.Why the lockfile matters
Cargo.lockwas stale and no longer built on current nightly. It's now tracked properly, so CI, contributors and the examples all build against the same, known-good dependency set.cargo auditwas reporting. Downstream users resolve their own dependencies, but our CI, examples and contributors now work on a clean tree, and future advisories will show up as a reviewable diff.reqwestturning on Tokio's multi-thread runtime as a side effect. Making it an explicit[dev-dependencies]entry keeps that requirement out of the library and states plainly what the examples need.What it means for you
openapi-sdk. Runrustup update stableif you're behind.What's next
As Luca put it, this PR is "the first of a series aimed at strengthening the CI / testing of this crate before any additional feature may be proposed." We'll keep you posted here as the series lands.
If you want to help, issues and PRs are open at openapi/openapi-rust-sdk. And if you've contributed to any Openapi® project, join the official contributors registry.
Once more, thank you @LucaCappelletti94 for getting this started! 🦀🚀
All reactions