The Rust team has released version 1.85, bringing several highly anticipated features to stable Rust.
Async Closures
The async || { ... } syntax is now stable, allowing closures that return futures. This has been one of the most requested features in the async ecosystem:
let fetch = async |url: &str| {
let response = reqwest::get(url).await?;
response.text().await
};
Previously, creating closures that captured their environment and returned futures required complex workarounds with Box<dyn Future>.
Polonius Borrow Checker
The new Polonius borrow checker is now enabled by default. It is more permissive than the previous NLL (Non-Lexical Lifetimes) checker, accepting more valid programs while maintaining Rust's safety guarantees. Code that previously required awkward restructuring to satisfy the borrow checker may now compile directly.
Trait System Improvements
- Return position impl Trait in traits β Methods can now use
-> impl Traitin trait definitions - Associated type bounds β Simplified syntax for bounding associated types
- Diagnostic attributes β Custom error messages for trait implementation failures
The Rust ecosystem continues to grow rapidly, with the language now ranked in the top 10 of the TIOBE index.