What's New in the Rust 2024 Edition
Rust evolves in small releases every six weeks, plus occasional editions that bundle changes which would otherwise break existing code. The 2024 edition shipped with Rust 1.85 in early 2025.
Editions don't split the ecosystem
Each crate picks its edition in Cargo.toml. Crates on different editions work together in the same build, so you can upgrade at your own pace.
[package]
name = "myapp"
edition = "2024"
Notable changes
- Async closures (
async || { ... }) arrived in Rust 1.85 alongside the edition, along with theAsyncFnfamily of traits. - Let chains - combine
if letwith other conditions using&&; stabilised for the 2024 edition in a later 1.x release. - Return-position impl Trait now captures all in-scope lifetimes by default, which removes a common source of confusing errors.
- Temporary lifetimes in
if letconditions and tail expressions were tightened, fixing surprising lock-holding behaviour. unsafe externblocks are required, and some attributes likeno_manglemust be markedunsafe(...).genis reserved as a keyword for future generator blocks.- Cargo uses a Rust-version-aware dependency resolver, preferring dependency versions compatible with your declared
rust-version.
// Let chains
if let Some(user) = find_user(id) && user.is_active && let Some(email) = &user.email {
send(email);
}
Migrating
rustup update
cargo fix --edition # applies automatic fixes while still on the old edition
# then set edition = "2024" in Cargo.toml
cargo build && cargo test
Most crates migrate with little or no manual work. Review the diff from cargo fix; a few changes (like temporary lifetimes) can subtly change when values are dropped.
Was this article helpful?
Comments
No comments yet. Have a question or a tip? Be the first to share it.