Latest in branch 1.85
1.85.1
Released 18 Mar 2025
(1 year ago)
SoftwareRust
Version1.85
Initial release1.85.0
20 Feb 2025
(1 year ago)
Latest release1.85.1
18 Mar 2025
(1 year ago)
Support status03 Apr 2025
(Ended 1 year, 2 months ago)
Release noteshttps://github.com/rust-lang/rust/releases/tag/1.85.1
Source codehttps://github.com/rust-lang/rust/tree/1.85.1
Downloadhttps://github.com/rust-lang/rust/releases/tag/1.85.1
Rust 1.85 ReleasesView full list

What Is New in Rust 1.85

CategoryHighlights
New FeaturesRust 2024 edition, async closures, diagnostic::do_not_recommend attribute, FromIterator/Extend for tuples up to 12, new unsafe functions in std::env and CommandExt
ImprovementsPrelude now includes Future and IntoFuture, IntoIterator for Box<[T]>, Cargo rust-version aware resolver, Rustdoc combined tests, Rustfmt style editions and sorting fixes
Breaking Changesextern blocks require unsafe, unsafe attributes need unsafe, unsafe_op_in_unsafe_fn lint warns by default, references to static mut are denied, missing macro fragment specifier is a hard error, never type fallback now denied
Deprecationsstd::env::home_dir() behavior updated and will soon lose its deprecation status

What new language features does Rust 1.85 introduce?

Rust 1.85 introduces the Rust 2024 edition, async closures, and several safety-related language changes.

  • Rust 2024 edition - the largest edition to date, adding RPIT lifetime capture rules, new temporary scopes, unsafe extern blocks, and more.
  • Async closures - write async || { ... } blocks that capture their environment and return a Future.
  • Diagnostic hint - the #[diagnostic::do_not_recommend] attribute hides blanket impl suggestions from error messages.
  • Tuple iterator extensions - FromIterator and Extend are now implemented for tuples up to twelve elements.
  • New unsafe functions - std::env::set_var, std::env::remove_var, and std::os::unix::process::CommandExt::before_exec are now marked unsafe.

How can I write asynchronous closures in Rust 1.85?

Async closures are now stable and let you write async || { ... } blocks that capture their environment and return a Future.

let mut log = Vec::new();

let fetch = async || {
    // The closure can borrow `log` mutably.
    log.push("started".to_string());
    async { 42 }.await
};

let result = futures::executor::block_on(fetch());
println!("Result: {result}, log: {log:?}");

They also enable higher-ranked signatures via the new AsyncFn, AsyncFnMut, and AsyncFnOnce traits in the prelude.

What breaking changes should I be aware of when upgrading to Rust 1.85?

Several safety checks have been hardened, making previously accepted code now a compile-time error.

  • Unsafe extern blocks - extern blocks must now be prefixed with unsafe.
  • Unsafe attributes - export_name, link_section, and no_mangle require the unsafe keyword.
  • unsafe_op_in_unsafe_fn - the lint now warns by default; you must wrap unsafe operations in an explicit unsafe { ... } block inside unsafe functions.
  • Static mut references - any reference to a static mut item is denied unless wrapped in an unsafe block.
  • Macro fragment specifiers - missing fragment specifiers are now a hard error, forcing explicit $(...:expr) style.
  • Never type fallback - the fallback coercion for ! is now denied, tightening type inference.

Watch out for these changes in existing codebases; most can be fixed by adding the required unsafe blocks or updating macro patterns.

How have Cargo, Rustdoc, and Rustfmt been improved in this release?

Cargo now respects the rust-version field during dependency resolution, Rustdoc runs doctests in a single binary, and Rustfmt adds style editions and sorting fixes.

  • Cargo - the resolver checks the rust-version field, preventing accidental use of crates that require a newer compiler.
  • Rustdoc - doctests are combined into one executable, dramatically speeding up documentation testing.
  • Rustfmt - introduces "style editions" so formatting can be decoupled from language edition, plus fixes for raw identifier sorting and version-aware identifier ordering.

Frequently Asked Questions

Do I need to modify my code to adopt the Rust 2024 edition?
Most code compiles unchanged; cargo fix can apply conservative migrations if needed.

How do I enable async closures in an existing project?
Just write async || { ... } and, if you need the traits, import AsyncFn, AsyncFnMut, or AsyncFnOnce from the prelude.

What command updates my toolchain to Rust 1.85?
Run rustup update stable.

Which attributes now require the unsafe keyword?
The export_name, link_section, and no_mangle attributes must be marked unsafe.

How does the new rust-version aware resolver affect my Cargo.toml?
Cargo will reject dependencies that need a newer compiler than the version declared in the rust-version field.

Is std::env::home_dir() still deprecated?
It remains deprecated, but its behavior has been fixed and the deprecation will be removed in a future release.

Releases In Branch 1.85

VersionRelease date
1.85.118 Mar 2025
(1 year ago)
1.85.020 Feb 2025
(1 year ago)