- Disjoint capture in closures, to simplify the writing of closures.
- Cargo.toml now supports a
[package] [rust-version]
field to specify the minimum supported Rust version for a crate, and Cargo will exit with an early error if that is not satisfied. While this currently does not influence the dependency resolver, the intent is catch compatibility problems before they turn into cryptic compiler errors. - New bindings in binding@pattern are supported. Rust pattern matching can be written with a single identifier that binds the entire value, followed by
@
and a more-refined structural pattern, but has not allowed additional bindings in that pattern until now. This functionality had been permitted prior to Rust 1.0, but was removed due to unsoundness. The compiler team now has determined that this pattern is safe and allowable in stable Rust. - Panic macros now always expect format strings, just like
printlin!()
. - A number of APIs have been stabilized including
std::os::unix::fs::chroot
andUnsafeCell::raw_get
.
The new features in Rust 1.55
Announced September 9, 2021, Rust 1.55 offers faster, more correct float parsing. The standard library implementation of float parsing has been updated to use the Eisel-Lemire algorithm, which brings improvements in speed and correctness. Previously, certain edge cases failed to parse, but these have now been fixed.
Also in Rust 1.55:
- The use of open ranges in patterns has been stabilized.
- A number of methods and trait implementations have been stabilized including
Bound::cloned
andDrain::as_str
. - Cargo now deduplicates compiler errors and prints a report at the end of compilation. Previously, when running
cargo test
,cargo check ---all targets
, or similar commands that built the same Rust crate in multiple configurations, errors and warnings might show up duplicated as the rustc executions were run in parallel and showed the same warning.
The new features in Rust 1.54
Published July 29, 2021, Rust 1.54 supports invoking function-like macros inside attributes. Function-like macros can be macros based on macro-rules!
or they can be procedural macros, which are invoked like macro!(…)
. A notable use case is including documentation from other files into Rust doc comments.
Other new features in Rust 1.54:
- A number of instrinsics for wasm32 platform have been stabilized. These give access to SIMD instructions in WebAssembly.
- Incremental compilation is re-enabled by default. It had been disabled by default in Rust 1.52.1. With Rust 1.52, additional validation was added when loading incremental compilation from on-disk cache, resulting in pre-existing potential soundness issues being uncovered as validation changed these silent bugs into internal compiler errors (ICE). Since then, work has been done to resolve these issues, with some fixes landing in Rust 1.53 and the majority landing in Rust 1.54. Remaining issues that could result in ICE are considered rare in practice.
- Multiple methods and trait implementations have been stabilized.
- Compiler output has been improved for debugging enums on Windows MSVC platforms for C++.
Rust 1.54 follows the June 17 release of Rust 1.53, which contained language and library features including the IntoIterator
implementation for arrays.
The new features in Rust 1.52
Introduced May 6, 2021, Rust 1.52 was led by an enhancement to tooling support for Clippy, which is a collection of lints to find mistakes and improve Rust code. Previously, running cargo check
followed by cargo clippy
would not actually run Clippy, with the build caching in Cargo not differentiating between the two. This has been fixed in Rust 1.52. Also in version 1.52, the following methods were stabilized:
Arguments::as_str
char::MAX
char::REPLACEMENT_CHARACTER
char::UNICODE_VERSION
char::decode_utf16
char::from_digit
char::from_u32_unchecked
char::from_u32
slice::partition_point
str::rsplit_once
str::split_once
Several previously stable APIs, including char::len_utf8
and u8LLeq_ignore_ascii_case
, are now const
. For the compiler, the default LLVM has been upgraded to LLVM 12. A subsequent point release of the language, Rust 1.52.1, published May 10, provides a workaround for a bug in incremental compilation that was made into a compiler error in Rust 1.52.0. Rust builders recommend either an upgrade to 1.52.1 or disabling incremental compilation.
The new features in Rust 1.51.0
Published March 25, 2021, the Rust 1.51.0 release is one of the largest additions to the language and Cargo package manager in quite some time, with the stabilization of an MVP (minimum viable product) implementation of const generics and a new feature resolver for Cargo among the highlights. Other highlights:
- With the const generics MVP, a tool is added for library designers in developing compile-time safe APIs. A highly anticipated feature, const generics are generic arguments that range over constant values, rather than types or lifetimes. This allows types to be parameterized by integers, for example. The plan is to introduce const generics gradually, so the only types that can be used as the type of a const generic argument currently are the types of integers, including
size
,usize
,char
, andbool
. - Along with const generics, a new API has been stabilized that uses it,
std::array::IntoIter
, which allows developers to create a by value iterator over any array. - For Cargo, the new feature resolver introduces an algorithm for computing package features to help avoid some unwanted unification with the current resolver.
- Improved compile times on MacOS, with improvements to speed up builds that include debug info and reduce the amount of disk space used.
- Items such as functions, traits, and structs can be parameterized by constant values in addition to types and lifetimes.
- Stabilized APIs, including stabilization of 18 new methods for types such as
slice
andPeekable
.
The new features in Rust 1.50.0
Published February 11, 2021, Rust 1.50.0 improves array indexing, expands safe access to union fields, and adds to the standard library. Specific improvements include:
- For const-generic array indexing, this release continues a progression toward stable
const
generics, adding implementations ofops::Index
andIndexMut
for arrays[T; N]
for any length ofConst N
. The indexing operator[ ]
already worked on arrays through the compiler, but at the type level, arrays did not actually implement the library traits until now. Also, stable use ofconst
values in array repetition is formally acknowledged. - Safe assignments to
ManuallyDrop<T>
union fields are permitted. - A niche for
File
on Unix platforms is now permitted. With this feature, some types in Rust have limitations on what is considered a valid value, which may not cover the range of possible memory values. Any remaining valid value is called a niche, with this space usable for type layout optimizations. On Unix platforms, Rust’sFile
is made of the system’s file integer descriptor; this happens to have a possible niche because it cannot be-1
! System calls that return a file descriptor use-1
to indicate an error occurred, so it is never possible for-1
to be a real file descriptor. Beginning with Rust 1.50, this is added to the type definition so it can be used in layout optimizations, too. It follows thatOption<File>
now will have the same size asFile
. - For Cargo, a
[rustc-workspace-wrapper]
option has been added, to set a wrapper to execute instead ofrustc
, for workspace members only. Also, the--workspace
flag has been added to thecargo update
command. - Nine new stable functions were added to the library:
bool::then
,btree_map::Entry::or_insert_with_key
,f32::clamp
,f64::clamp
,hash_map::Entry::or_insert_with_key
,Ord::clamp
,RefCell::take
,slice::fill
, andUnsafeCell::get_mut
. - Also in the library, several existing functions were made
const
:IpAddr::is_ipv4
,IpAddr::is_ipv6
,Layout::size
,Layout::align
,Layout::from_size_align
,pow
for all integer types,checked_pow
for all integer types,saturating_pow
for all integer types,wrapping_pow
for all integer types,next_power_of_two
for all unsigned integer types, andchecked_power_of_two
for all unsigned integer types.
The new features in Rust 1.49.0
Announced December 31, 2020, Rust 1.49.0 designates 64-bit Arm Linux as a Tier 1 target, thus providing the highest support guarantee, with the full test suite run on this platform on every change merged in the compiler. This support is expected to benefit workloads spanning from embedded systems to servers and desktops. Prebuilt binaries also are available. This marks the first time a non-x86 target has reached Tier 1 support. The Rust development team hopes to bring more platforms into this tier in the future.
Also with Rust 1.49.0, 64-bit Arm for MacOS and Windows reach Tier 2 support. Developers can expect these two targets to have prebuilt binaries installable from rustup
. Tier 2 targets are guaranteed to build, and prebuilt binaries are provided. However, the Rust team does not execute the test suite on those platforms. Produced binaries may not work and might have bugs.
Other additions, improvements, and changes in Rust 1.49.0:
- Three stable functions have been added to the library:
slice::select_nth_unstable
,slice::select_nth_unstable_by
, andslice::select_nth_unstable_by_key
. - Two library functions were made
const
:Poll::is_ready
andPoll::is_pending
. - For the language, unions now can implement
Drop
and developers now can have a field in a union withManuallyDrop<T>
. Also, uninhibited enums can be cast to integers. - Developers can bind by reference and bind by move in patterns, enabling developers to selectively borrow individual components of a type.
- For the compiler, the minimum supported version of LLVM has been moved to LLVM 9.
The new features in Rust 1.48.0
Unveiled on November 19, 2020, Rust 1.48.0 features easier linking in the Rustdoc library documentation tool, with syntax to let Rustdoc know when developers are trying to link to a type; URLs will be generated. Also in version 1.48.0:
- Developers can specify
#{doc(alias = “<alias>”) ]
on items to add search aliases when searching through the Rustdoc UI. - The
unsafe
keyword is now syntactically permitted on modules. While still rejected semantically, this can now be parsed by procedural macros. - In the compiler, the
-C link-self-contained=<yes|no>
compiler flag is stabilized. This tellsrustc
whether to link its own C runtime and libraries or rely on an external linker to find them. This is supported only onwindows-gnu
,linux-musl
, andwasi
platforms. - In the library, the
[T; N]: TryFrom<Vec<T>>
API is now stable. Developers can use it to try to turn a vector into an array of a given length. Also stabilized in this release were five other APIs:slice::as_ptr_range
,slice::as_mut_ptr_range
,VecDeque::make_contiguous
,future::pending
, andfuture::ready
. - Also in the library, all arrays of any length now implement
TryFrom<Vec<T>>
.
The new features in Rust 1.47.0
Announced October 8, 2020, Rust 1.47.0 has no new language features but enhances the standard library. Quality of life and toolchain improvements as well as library stabilizations are featured in the release. Release notes have been published for the upgrade.
Specific capabilities in Rust 1.47.0 include:
- A “const generics” feature, impacting traits on larger arrays. The feature still needs to be stabilized. Rust has lacked a way to be generic over integer values, which has caused problems with arrays. This capability is intended to address this issue and make arrays more useful.
- An upgrade to LLVM 11 compiler infrastructure, making it the default.
- Shorter backtraces, making it easier to find issues.
rustc
now supports-C control-flow-guard
, an option that will switch on the Control Flow Guard security capability on Windows. Other platforms ignore this flag.- Rustdoc now supports the Ayu theme.
- Nine APIs in the standard library were stabilized: Ident::new_raw, Range::is_empty, RangeInclusive::is_empty, Result::as_deref, Result::as_deref_mut, Vec::leak, pointer::offset_from, f32::TAU, and f64::TAU.
The new features in 1.46.0
Rust 1.46, announced on August 27, 2020, includes the following capabilities:
- Several core language features now can be used in
const fn
, includingif
,if let
,match
, and several others. - A
#[track_caller]
attribute, designed to improve error messages whenunwrap
and related functions panic, is now stable. - In a change to the library,
std::mem::forget
is now aconst fn
. Also in the library, two new APIs were stabilized:Option::zip
andvec::Drain::as_slice
. - For the compiler, the
citylib
target can be used on Apple iOS and tvOS platforms. - Recursively indexing into tuples no longer requires parentheses.
The new features in Rust 1.45.0
Announced on July 16, 2020, Rust 1.45 includes the following additions and improvements:
- A fix is offered to mend some longstanding unsoundness when casting between integers and floats.
- Stabilization is offered for function-like procedural macros in expressions, patterns, and statements. Expansion of the use of macros assists with use of the Rocket web framework for Rust.
- Several library APIs have been stabilized, such as
Arc::as_ptr
,BTreeMap::remove_entry
, andSpan::resolved_at
. The full list of APIs can be found in the Rust Blog.
The new features in Rust 1.43.1
This point release was introduced May 7, 2020, to address two regressions introduced in the 1.43.0 stable release. It also updates the OpenSSL version used by the Cargo package manager. Features include:
- Rust 1.27 introduced support for detecting x86 CPU features in the standard library, via the
is_x86_feature_detected
macro. Because of an internal refactoring, Rust 1.43.0 prevented detection of features that cannot be used on stable yet, even though detecting them previously was allowed. Version 1.43.1 fixes this regression. - A fix is offered for broken
cargo package –list
command. Rust 1.43 broke support for listing files included in packages published with Cargo, when executed inside a workspace with path dependencies or unpublished versions. - OpenSSL, a Cargo dependency, has been updated to 1.1.1g. OpenSSL had released a security advisory but the Rust team was not able to include the fix in time for Rust 1.43.0. The team has no evidence the vulnerability could compromise Cargo users’ security.