Rust 1.85 Released: Async Closures and Compiler Boosts Highlight Latest Edition

Riley King

Riley King

February 28, 2025 · 3 min read
Rust 1.85 Released: Async Closures and Compiler Boosts Highlight Latest Edition

The Rust programming language has taken a significant leap forward with the release of Rust 1.85, which brings a slew of exciting updates, including async closures, improved compiler support, and stabilized APIs. This latest edition, also known as the Rust 2024 edition, marks a major milestone in the language's evolution, offering developers a more expressive and efficient way to write code.

One of the most notable features in Rust 1.85 is the introduction of async closures, which return futures when called. This feature has been a long-standing goal of the Rust 2024 project, and its implementation is expected to increase the expressiveness of the Rust language. Async closures work similarly to async functions, but with the added ability to capture values from the local environment. This update addresses previous shortcomings in Rust when writing asynchronous code that uses closures and Fn trait bounds.

In addition to async closures, Rust 1.85 also includes a new attribute, #[diagnostic::do_not_recommend], which serves as a hint to the compiler not to show the annotated trait implementation as part of a diagnostic message. This feature is particularly useful for library authors, as it allows them to prevent the compiler from making suggestions that may be misleading or unhelpful. Furthermore, the compiler in Rust 1.85 removes the unstable flag, -Zpolymorphize, and panics in the standard library now have a leading /library in their path.

Stabilized APIs in Rust 1.85 include BuildHasherDefault::new, ptr::fn_addr_eq, and Unsigned {integer}::midpoint, as well as a new tuple extension. The tuple extension builds upon previous convenience traits for iterators of (T, U) tuple pairs, which were introduced in Rust 1.56 and 1.79. These traits have now been extended to support more tuple lengths, ranging from singleton (T,) to 12 items long, (T1, T2, .., T11, T12).

The Rust 2024 edition is the largest edition of the language ever released, offering a mechanism for opt-in changes that might otherwise present a backward compatibility risk. To facilitate a smooth transition, the Rust team has set up a guide for transitioning projects to the 2024 edition. This guide provides developers with a comprehensive resource for navigating the changes and updates in Rust 1.85.

The release of Rust 1.85 is a significant milestone in the language's evolution, demonstrating the Rust team's commitment to improving the language's performance, safety, and ease of use. With its focus on asynchronous programming and compiler support, Rust 1.85 is poised to have a major impact on the development community, enabling developers to write more efficient and expressive code.

Developers can download Rust 1.85 on GitHub, and those with a previous version of Rust installed via rustup can access the latest edition using the command: rustup update stable. As the Rust language continues to evolve, it will be exciting to see how developers leverage the new features and updates in Rust 1.85 to build innovative and impactful applications.

Similiar Posts

Copyright © 2024 Starfolk. All rights reserved.