Email me

Rust versions / 1.62

Rust release · Jun 30, 2022

Rust 1.62: what's new, what was stabilized

Short answerRust 1.62 was released on Jun 30, 2022: 1 language stabilization ([Stabilize #[derive(Default)] on enums with a #[default] variant][94457]); 9 newly stable APIs (bool::then_some, f32::total_cmp, f64::total_cmp, Stdin::lines, ...); 5 compatibility notes that can affect existing code. Point release: 1.62.1 (Jul 19, 2022).

Jun 30, 2022release date
1language stabilizations
9APIs stabilized
-new edition

← Rust 1.61All versionsRust 1.63 →

Language features stabilized

  • [Stabilize #[derive(Default)] on enums with a #[default] variant][94457]

9 APIs stabilized

bool::then_some, f32::total_cmp, f64::total_cmp, Stdin::lines, windows::CommandExt::raw_arg, impl<T: Default> Default for AssertUnwindSafe<T>, From<Rc<str>> for Rc<[u8]>, From<Arc<str>> for Arc<[u8]>, FusedIterator for EncodeWide

Can it break my build?

The release lists these compatibility notes. Most only affect rare code, but read them before you raise your toolchain in CI:

  • cargo test now passes --target to rustdoc if the specified target is
  • [rustdoc: doctests are now run on unexported macro_rules! macros, matching other private items][96630]
  • [rustdoc: Remove .woff font files][96279]
  • [Enforce Copy bounds for repeat elements while considering lifetimes][95819]
  • [Windows: Fix potential unsoundness by aborting if File reads or writes cannot

Use it

rustup update stable        # get the newest release
rustup install 1.62          # or exactly this one
rustup override set 1.62     # pin a project to it

To require at least this version from users of your crate, set rust-version = "1.62" under [package] in Cargo.toml. Cargo then refuses to build it on older compilers with a clear message, and with resolver 3 (the default on the 2024 edition, Rust 1.85+) it also prefers dependency versions that support it.

Full release notes

Language

  • [Stabilize #[derive(Default)] on enums with a #[default] variant][94457]
  • [Teach flow sensitive checks that visibly uninhabited call expressions never return][93313]
  • [Fix constants not getting dropped if part of a diverging expression][94775]
  • [Support unit struct/enum variant in destructuring assignment][95380]
  • [Remove mutable_borrow_reservation_conflict lint and allow the code pattern][96268]
  • [const functions may now specify extern "C" or extern "Rust"][95346]

Compiler

  • [linker: Stop using whole-archive on dependencies of dylibs][96436]
  • [Make unaligned_references lint deny-by-default][95372] This lint is also a future compatibility lint, and is expected to eventually become a hard error.
  • [Only add codegen backend to dep info if -Zbinary-dep-depinfo is used][93969]
  • [Reject #[thread_local] attribute on non-static items][95006]
  • [Add tier 3 aarch64-pc-windows-gnullvm and x86_64-pc-windows-gnullvm targets\*][94872]
  • [Implement a lint to warn about unused macro rules][96150]
  • [Promote x86_64-unknown-none target to Tier 2\*][95705]

\* Refer to Rust's [platform support page][platform-support-doc] for more information on Rust's tiered platform support.

Libraries

  • [Windows: Use a pipe relay for chaining pipes][95841]
  • [Replace Linux Mutex and Condvar with futex based ones.][95035]
  • [Replace RwLock by a futex based one on Linux][95801]
  • [std: directly use pthread in UNIX parker implementation][96393]

Stabilized APIs

  • [bool::then_some]
  • [f32::total_cmp]
  • [f64::total_cmp]
  • [Stdin::lines]
  • [windows::CommandExt::raw_arg]
  • [impl<T: Default> Default for AssertUnwindSafe<T>]
  • [From<Rc<str>> for Rc<[u8]>][rc-u8-from-str]
  • [From<Arc<str>> for Arc<[u8]>][arc-u8-from-str]
  • [FusedIterator for EncodeWide]
  • [RDM intrinsics on aarch64][stdarch/1285]

Clippy

  • [Create clippy lint against unexpectedly late drop for temporaries in match scrutinee expressions][94206]

Cargo

  • Added the cargo add command for adding dependencies to Cargo.toml from the command-line. docs
  • Package ID specs now support name@version syntax in addition to the previous name:version to align with the behavior in cargo add and other tools. cargo install and cargo yank also now support this syntax so the version does not need to passed as a separate flag.
  • The git and registry directories in Cargo's home directory (usually ~/.cargo) are now marked as cache directories so that they are not included in backups or content indexing (on Windows).
  • Added automatic @ argfile support, which will use "response files" if the command-line to rustc exceeds the operating system's limit.

Compatibility Notes

  • cargo test now passes --target to rustdoc if the specified target is the same as the host target. #10594
  • [rustdoc: doctests are now run on unexported macro_rules! macros, matching other private items][96630]
  • [rustdoc: Remove .woff font files][96279]
  • [Enforce Copy bounds for repeat elements while considering lifetimes][95819]
  • [Windows: Fix potential unsoundness by aborting if File reads or writes cannot complete synchronously][95469].

Internal Changes

These changes provide no direct user facing benefits, but represent significant improvements to the internals and overall performance of rustc and related tools.

1.62.1 (Jul 19, 2022)

Rust 1.62.1 addresses a few recent regressions in the compiler and standard library, and also mitigates a CPU vulnerability on Intel SGX.

Release notes from the Rust project's RELEASES.md (MIT or Apache-2.0); summaries above are ours.

← Rust 1.61All versionsRust 1.63 →

Up next

Next releaseRust 1.63Released Aug 11, 2022.Read it next →

Did this answer your question?

Get the receipts by email.

What my AI agents tried this week, with the real numbers: what worked, what flopped, what made money. One email when there is something worth reading.

No spam, never sold. Every email has a one-click unsubscribe.

Popular in the shop

All 124 tools →

Browse: Bundles and kitsHome, family and schoolMoney and businessAI toolsSports and fitnessMaking and hobbiesFood and drinkIndie dev and launchTrading and quant

Free: Landing page teardown iPhone app cost calculator LLM API cost calculator Paid online: $49 Launch Check App builds Articles FAQ