Latest in branch 1.62
1.62.1
Released 19 Jul 2022
(3 years ago)
SoftwareRust
Version1.62
Initial release1.62.0
30 Jun 2022
(3 years ago)
Latest release1.62.1
19 Jul 2022
(3 years ago)
Support status12 Sep 2022
(Ended 3 years, 8 months ago)
Release noteshttps://github.com/rust-lang/rust/releases/tag/1.62.1
Source codehttps://github.com/rust-lang/rust/tree/1.62.1
Downloadhttps://github.com/rust-lang/rust/releases/tag/1.62.1
Rust 1.62 ReleasesView full list

What Is New in Rust 1.62

CategoryHighlights
New Featurescargo add command, #[default] on enum variants, bare-metal x86_64-unknown-none target
ImprovementsFutex-based Mutex/Condvar/RwLock on Linux (5-byte Mutex), Tier-2 promotion of x86_64-unknown-none

How can I add dependencies directly from the command line with Cargo?

In Rust 1.62 you can add new crates without editing Cargo.toml by using the new cargo add subcommand.

  • Basic addition:
    cargo add log
  • Specify features:
    cargo add serde --features derive
  • Pin a version:
    cargo add nom@5

This matters if you want to prototype quickly or automate dependency updates in CI pipelines.

How do I derive Default for enums in Rust 1.62?

You can now annotate a unit variant with #[default] and keep the automatic #[derive(Default)] implementation.

#[derive(Default)]\nenum Maybe {\n    #[default]\n    Nothing,\n    Something(T),\n}

Only variants without fields are allowed to be the default, which simplifies boilerplate for many option-like enums.

What performance gains do the new Linux mutex implementations bring?

The standard library now uses a raw futex-based lock on Linux, shrinking the internal state of Mutex to just 5 bytes.

  • No hidden heap allocation - the lock lives entirely on the stack.
  • Reduced memory footprint improves cache locality for high-contention workloads.
  • Future work may further shrink Condvar and RwLock similarly.

In practice this matters for low-level services, embedded daemons, or any code that creates many synchronization primitives.

How do I target bare-metal x86_64 with the new Tier-2 support?

Rust 1.62 promotes the x86_64-unknown-none target to Tier 2, making it easy to build OS-less binaries.

rustup target add x86_64-unknown-none\nrustc --target x86_64-unknown-none my_no_std_program.rs

This matters if you are writing kernels, bootloaders, or other no_std environments; the target is now officially supported and receives regular updates.

Frequently Asked Questions

What command updates Rust to the latest stable version?
rustup update stable

Can I use cargo add to specify a version range?
Yes you can add a dependency with a specific version like cargo add nom@5

Which enum variants can be marked #[default]?
Only unit variants without fields can be annotated with #[default]

How much memory does a Mutex now occupy on Linux?
In Rust 1.62 a Mutex needs only 5 bytes for its internal state on Linux

Do I need to enable any feature to use the x86_64-unknown-none target?
No extra feature flags are required; just add the target with rustup target add x86_64-unknown-none and compile with --target

Are there any breaking changes in Rust 1.62?
The release does not introduce breaking changes; existing code should compile unchanged

Releases In Branch 1.62

VersionRelease date
1.62.119 Jul 2022
(3 years ago)
1.62.030 Jun 2022
(3 years ago)