The unique approach of the Rust programming language results in better code with fewer compromises than C, C++, Go, and the other languages you probably use. It also gets updated regularly, often every month.
Where to download the latest Rust version
If you already have a previous version of Rust installed via rustup, you can access the latest version via the following command:
$ rustup update stable
The new features in Rust 1.68
Rust 1.68.0, announced March 9, stabilizes the “sparse” registry protocol for the Cargo package manager for reading the index of crates, along with infrastructure at http//index.crates.io/ for those published in the primary crates.io registry. The previous Git protocol, still the default, clones a repository that indexes all crates available in the registry. However, the Git protocol has begun to hit scaling limitations, with delays while updating the repository. The new protocol is expected to improve performance when accessing crates.io.
To use the sparse protocol with crates.io, set the environment variable
CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse, or edit your
.cargo/config/toml file to add:
[registries.crates-io]protocol = "sparse"
The sparse protocol is set to become the default for crates.io in Rust 1.70.0, which is due in a few months.
Elsewhere in Rust 1.68.0, a new
pin! macro constructs a
Pin<&mut T> from a
T expression, anonymously captured in local state. This often is called stack pinning, but that “stack” also could be the captured state of an
async fn or block. This macro is similar to some crates, but the standard library can leverage
Pin internals and temporary lifetime extension for a more expression-like macro.
The new features in Rust 1.67
Rust 1.67, unveiled January 26, adds a compiler warning pertaining to
async fn. In Rust,
async functions annotated with
#[must_use] now apply that attribute to the output of the returned
impl Future. The
Future trait already is annotated with
#[must_use], so types implementing
[Future] are automatically
#[must_use]. Previously there was no way to indicate that the output of the
Future is itself significant and should be used in some way. In Rust 1.67, the compiler now will warn if the output is not used.
Also in Rust 1.67, the implementation of the multi-producer, single-consumer channel of the standard library has been updated. Rust’s standard library has had a multi-producer, single-consumer channel since before version 1.0. With Rust 1.67, the implementation has been switched out to be based on
crossbeam-channel. The release contains no API changes but the new implementation fixes bugs and improves performance and maintainability of the implementation.
Rust 1.67 stabilizes several APIs such as
NonZero*::BITS. A number of other APIs are now stable in
const contexts including
char::to_digit. And invalid literals no longer are an error under
Note: Rust 1.66.1 stable, released January 10, fixed a situation in which the Cargo package manager was not verifying SSH host keys when cloning dependencies or registry indexes with SSH. This vulnerability was tracked at cve.org, with more information in the advisory.
The new features in Rust 1.66
Introduced December 15, 2022, Rust 1.66 enables enums with integer representations to now use explicit discriminants, even when they have fields. Previously, developers could use explicit discriminants on enums with representations, but only if none of their variants had fields. Explicit discriminants are useful when passing values across language boundaries where the representation of the enum must match in both languages.
Also in Rust 1.66:
- A newly stabilized
black_boxfunction takes a passed value and passes it right back. The compiler treats
black_boxas a function that could do anything with its input and return any value. This is useful for disabling optimizations when you don’t want them to occur, such as during benchmarking or when examining the machine code the compiler produces.
- Developers can use
cargo removeto remove dependencies. Rust 1.62 introduced
cargo add, a command line utility to add dependencies to a project.
- Developers now can use
..=xranges in patterns.
- Linux builds now optimize the rustc front end and LLVM back end with LTO and BOLT, respectively, improving runtime performance and memory usage.
- APIs have been stabilized such as
The new features in Rust 1.65
Rust 1.65 was introduced November 3, 2022. With this release, generic associated types (GATs), a highly anticipated feature that has been in the works for several years, are finally introduced. GATs allow developers to define lifetime, type, and const generics on associated types. GATs enable patterns that were not previously possible in Rust.
Also in Rust 1.65:
- A new type of
letstatement is introduced,
let-else, with a refutable pattern and a diverging
elseblock that executes when that pattern does not match.
- Plain block expressions now can be labeled as a
breaktarget, terminating that block early.
- To improve compilation, support for splitting debug information is now stable for use on Linux, after being supported on macOS since Rust 1.51. With this capability,
-Csplit-debuginfo=unpackedwill split debuginfo into multiple .dwo DWARF object files, while
-Csplit-debuginfo=packedwill produce a single .dwp DWARF package along with an output binary with all debuginfo packaged together.
- APIs have been stabilized such as
Bound::as ref, and
- MIR (mid-level intermediate representation) inlining now is enabled for optimized compilations, improving compile times for real world crates.
- When scheduling builds, Cargo now sorts the queue of pending jobs, improving performance.
The new features in Rust 1.64
Rust 1.64.0, unveiled September 22, 2022, stabilizes the
IntoFuture trait, to enhance
.await and improve APIs.
IntoFuture is similar to the
IntoIterator trait, but instead of supporting
for … in … loops,
IntoFuture changes how
.await keyword can await more than just features; it can await anything that can be converted into a
IntoFuture, to help make APIs more user-friendly. For the future, the developers of Rust hope to simplify development of new named futures by supporting
impl Trait in
type aliases. This should make implementing
IntoFuture easier by simplifying the
type alias signature and make it more performant by removing the
Box from the
Also in Rust 1.64:
- The language provides all
c_*type aliases in
core::ffi, as well as
core::ffi::CStr, for working with C strings. Rust 1.64 also provides
alloc::ffi::CStringfor working with owned C strings using only the
alloccrate rather than the full
- rust-analyzer, an implementation of the Language Server protocol for Rust, now is included as part of the collection of tools included with Rust. This makes it easier to download and access rust-analyzer and makes it available on more platforms. The tool is available as a rustup component and can be installed with the command
rustup component add rust_analyzer.
- When working with collections of related libraries or binary crates in one Cargo workspace, developers now can avoid duplication of common field values between crates, such as common version numbers or repository URLs.
- The memory layouts of
SocketAddrV6have been changed to be more memory efficient and compact.
- Windows builds of the Rust compiler now use profile-guided optimization, improving performance.
- A number of methods and trait implementations have been stabilized, including
num::NonZero*::checked_pow, and many others.
The new features in Rust 1.63
Published August 11, 2022, Rust 1.63 adds scoped threads to the standard library. Scoped threads allow you to spawn a thread by borrowing from the local stack frame. The
std::thread::scope API provides a guarantee that any spawned threads will have exited prior to its returning, allowing for safely borrowing data. Rust 1.63 also enables non-lexical lifetimes (NLL) by default; the feature is now fully stable. NLL is the second iteration of Rust’s borrow checker.
Also in Rust 1.63:
- For I/O safety, wrapper types are provided such as
OwnedFD, which are marked as
#[repr(transparent)], meaning that
extern "C"bindings can take these types to encode ownership semantics.
RwLock::newfunctions are now callable in
constcontexts, to avoid the use of crates such as lazy_static for creating global statics with
Condvar. This builds on work in Rust 1.62 to enable faster and thinner mutexes.
- A number of APIs were stabilized including
The new features in Rust 1.62
Rust 1.62, which arrived June 30, 2022, lets developers add dependencies directly from the command line using
cargo add. This command supports specifying versions and features and also can modify existing dependencies. Rust 1.62 also allows the use of #[derive(Default)] on enums if a default variant is specified.
Other new capabilities in Rust 1.62:
- Rust’s standard library now ships with a raw futex-based implementation of locks on Linux, which is lightweight and does not carry any extra allocation. This addition is part of an effort to improve the efficiency of Rust lock types.
- It is now easier to build OS-less binaries for x86_64, for example when writing a kernel. The x86_64-unknown-none target has been promoted to Tier 2 and can be installed with rustup.
- A number of APIs have been stabilized including bool::then_some, f32::total_cmp, f64::total_cmp, and Stdin::lines.
The new features in Rust 1.61
Published May 19, 2022, Rust 1.61 highlights custom exit codes from
main. Rust proponents said that in the beginning, Rust
main functions only could return the unit type
() either implicitly or explicitly, indicating success in the exit status, and if developers wanted otherwise, they had to call
process::exit. Since Rust 1.26,
main has been allowed to return a
Ok translated to a C
EXIT_Failure. These alternate return types were unified by an unstable Termination trait. In this release,
Termination trait is stable, along with a more-general
ExitCode type that wraps platform-specific return types. The
Termination trait also can be implemented for a developer’s own types, allowing for customization of reporting before converting to an
Also in Version 1.61:
- Several incremental features have been stabilized to enable more functionality in
const. Developers now can create, pass, and cast function pointers in a
const fn, which could be useful to build compile-time function tables for an interpreter. But it is still not permitted to call
fnpointers. Developers also now can write trait bounds on generic parameters to
const fn, such as
T: Copy, where previously only
Sizedwas permitted. Also,
const fnnow can deal with trait objects, whereas arguments and return values for
const fncan be opaque
- APIs have been stabilized such as
- Previously, the creation of locked handles to
stdin/stdlout/stderrwould borrow the handles being locked, which prevented writing
let out = std::io::stdout().lock();because
outwould outlive the return value of
stdout(). This code now works, eliminating a common pitfall affecting many Rust users.
The new features in Rust 1.60.0
Rust 1.60, introduced April 7, 2022, stabilizes support for LLVM-based coverage instrumentation in
rustc. This provides for source-based code coverage. Developers can try this out by rebuilding their code with
-Cinstrument-coverage. Afterward, running the resulting binary will produce a default.profraw file in the current directory.
llvm-tools-preview component includes
llvm-profdata for processing and merging raw profile output,
llvm-profdata for processing raw file output, and
llvm-cov for report generation. Baseline functionality is stable and will exist in all future Rust releases, but the specific output format and LLVM tools that produce it are subject to change. Developers should use the same version for both
llvm-tools-preview and the
rustc binary used to compile code.
Rust 1.60 also re-enables incremental compilation. The Rust team continues to work on fixing bugs in incremental but no problems causing widespread breakage are known at this time.
Also in Rust 1.60: