Rust Language

What’s new in Rust 1.76

Rust was designed to make it easy to develop fast and safe system-level software. Here’s what’s new.

What’s new in the Rust programming language
Gratisography (CC0)

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.76.0

Described as relatively minor by the Rust Release Team, Rust 1.76 was unveiled February 8 and offers ABI compatibility updates. A new ABI compatibility section in function pointer documentation describes what it means for function signatures to be ABI-compatible. 

ABI compatibility consists largely of the compatibility of argument types and return types. The ABI compatibility documentation lists types that are guaranteed to be ABI-compatible and notes types that are not ABI-compatible in general. One new addition to this list: It is now guaranteed that char and u32 are ABI-compatible. They have always had the same size and alignment, but are now considered equivalent in functional call ABI as well.

Rust 1.76 also provides a new way to get type names from references. The any::type_name_of_val(&T) will return a descriptive name from any reference to any type.

Finally, Rust 1.76 also stabilizes nine APIs:

  •    Arc::unwrap_or_clone
  •    Rc::unwrap_or_clone
  •    Result::inspect
  •    Result::inspect_err
  •    Option::inspect
  •    type_name_of_val
  •    std::hash::{DefaultHasher, RandomState}
  •    ptr::{from_ref, from_mut}
  •    ptr::addr_eq

The new features in Rust 1.75.0

Introduced December 28, Rust 1.75.0 supports the use of asyn fn and -> impl Trait in traits. However, the initial release comes with some limitations, which are expected to be lifted in future releases.

Also in Rust 1.75.0, the compiler continues to get faster, with the release including the application of the BOLT optimizer to binary releases, bringing a 2% elapsed time improvement on benchmarks. BOLT optimizes the layout of the librustc_driver.so library containing most of the rustc code, for better cache utilization.

Further, the Rust development team now is building rustc with -Ccodegen-units=1, offering more opportunity for optimizations in LLVM. This optimization has brought a separate 1.5% improvement to benchmarks.

Rust 1.75.0 also features stabilized APIs including Atomic*::from_ptr, FileTimes, FileTimesExt, File::set_modified, File::set_times, and IpAddr::to_canonical.

The new features in Rust 1.74.0

Unveiled November 16, Rust 1.74.0 homes in on the Cargo package manager with several features. Rust 1.74.0 offers lint configuration through Cargo. The Cargo.toml manifest now supports a [lints] table to configure the reporting level (forbid, deny, warn, allow) for lints from the compiler and other tools. With this capability, there is no need to set RUSTFLAGS (-F, -D, -W, -A), which would affect an entire build, or use create-level attributes such as:

#![forbid(unsafe_code)]#![deny(clippy::enum_glob_use)]

Developers now can write those attributes in a package manifest for Cargo to handle:

[lints.rust]unsafe_code = "forbid" [lints.clippy]enum_glob_use = "deny"

These also can be configured in a [workspace.lints] table, then inherited by [lints] workspace = true like other workspace settings. Cargo tracks changes to these settings when deciding which crates to rebuild.

Other Cargo-related capabilities highlighted in Rust 1.74.0 include credential providers and authenticated private registries. Credential providers enable configuration of how Cargo gets credentials for a registry. Built-in providers are included for OS-related secure secret storage on Linux, Windows, and macOS. Custom providers can be developed to support arbitrary methods of storing or generating tokens.

Registries now optionally can require authentication for all operations, not just publishing. This enables private Cargo registries to provide more secure hosting of crates. Use of private registries requires the configuration of a credential provider.

Rust 1.74.0 fixes a situation in which errors were received that “a return type cannot contain a projection or Self that references lifetimes from a parent scope.” The compiler now allows mentioning Self and associated types in opaque return types, such as async fn and -> impl Trait. This feature gets Rust closer to how the language might be expected to work, the Rust Release Team said. This functionality had an unstable feature gate because its implementation originally did not properly deal with captured lifetimes. Once that was fixed, it was given time to make sure it was sound.

Rust 1.74.0 stabilizes a number of APIs such as core::num::Saturating, std::io::Error::other, and impl_TryFrom<char> for u16. The release also raises the minimum requirements for Apple platforms to macOS 10.12 Sierra, iOS 10, and tvOS 10.

The new features in Rust 1.73.0

Rust 1.73.0, published October 5, brings cleaner panic messages. The output produced by the default panic handler has been altered to put panic messages on their own line instead of wrapping in quotes. This can make panic messages easier to read, the Rust release team said. Also, panic messages produced by assert-eg and assert-ne have been modified, moving the custom message and removing some unnecessary punctuation.

Rust 1.73.0 also features thread local initialization. LocalKey<Cell<T>> and LocalKey<RefCell<T>> now can be directly manipulated with get(), set(), and replace() methods instead of jumping through a with(|inner| …) closure as needed for general LocalKey work. LocalKey<T> is the type of thread_local! statics. The new methods make common code more concise and avoid running extra initialization code for the default value specified in thread_local! for new threads. Rust 1.73 also stabilizes a number of APIs.

The new features in Rust 1.72.0

Announced August 24, Rust 1.72.0 lets developers conditionally enable code using the cfg operator, for configuration conditional checks, to provide certain functions only with certain crate features or only on particular platforms. Previously, items disabled like this effectively would be invisible to the compiler. With Rust 1.72.0, the compiler will remember the name and cfg conditions of those items. It could report, for example, if a function a developer tried to call is unavailable because a crate feature must be enabled.

Also in Rust 1.72.0, const evaluation time now is unlimited. Rust previously limited the maximum number of statements run as a part of any given constant evaluation, to prevent user-provided const evaluation from getting into a compile-time infinite loop or otherwise taking unbounded time at compile. Developers now can do an unlimited amount of const evaluation at compile time. 

Elsewhere in Rust 1.72.0, several lints from Clippy have been pulled into rustc. And a number of APIs have been stabilized including CStr::from_bytes_with_nul and CStr::to_Bytes.

In a future release, the Rust development team plans to increase the minimum-supported Windows version to Windows 10. Rust 1.75 is slated to be the last Rust version to officially support Windows 7, Windows 8, and Windows 8.1.

Rust 1.72.0 follows Rust 1.71.1 from August 3, which fixed a situation in which the Cargo package manager was not respecting the unmask when extracting dependencies, which could have enabled a local attacker to edit the cache of extracted source code of another user. Rust 1.71.1 also addressed several regressions introduced in Rust 1.71.0, including Bash completion being broken for users of the Rustup toolchain installer.

The new features in Rust 1.71.0

Rust 1.71.0 was introduced on July 13. With this version, Rust on Windows platforms supports using functions from dynamic libraries without requiring those libraries to be available at build time, using a new kind="raw-dylib”" option for #[link]. This saves users from having to install those libraries, which is particularly an issue for cross-compilation, and avoids having to ship stub versions of libraries in crates to link against. Rust 1.71.0 also supports binding symbols provided by DLLs by ordinal rather than named symbol, via a new #link_ordinal attribute.

Also new and improved in Rust 1.71.0:

  • For debugging visualization, support is stabilized for a new attribute, #[debug_visualizer(natvis_file = "...")] and #[debug_visualizer(gdb_script_file = "...")], that allows embedding Natvis XML framework descriptions and GDB scripts into Rust libraries to improve debugger output when inspecting data structures created by those libraries. Rust has packaged similar scripts for some time for the standard library. This feature makes it possible for library writers to provide a similar experience to users.
  • Rust 1.71.0 stabilizes c-unwind and other -unwind suffixed ABI variants. Each ABI is the equivalent of the same ABI without -unwind, except that with -unwind the behavior is defined to be safe when an unwinding operation (a panic or C++ style exception) crosses the ABI boundary. For panic-unwind, this is a valid way to let exceptions from one language unwind the stack in another language without terminating the process, as long as the exception is caught in the same language from which it originated. For panic=abort, this typically will abort the process immediately. For this initial stabilization, no change is made to existing ABIs; unwinding across them remains undefined behavior. A future Rust release will amend these ABIs to match the behavior specified in a related RFC as the final part of stabilizing this feature, usually aborting at the boundary. Developers are encouraged to start using new unwind ABI variants in their code to remain future-proof if they must unwind across the ABI boundary.
  • Various *-linux-musl targets will ship with musl 1.2.3, an implementation of the C standard library built atop the Linux system call API. Most users are not expected to be affected by this.
  • Several APIs have been stabilized such as CStr::is_empty and BuildHasher::hash_one.

The new features in Rust 1.70

Debuting June 1, 2023, Rust 1.70 enables by default the “sparse” protocol for Cargo for reading the index from crates.io. This feature had been stabilized in Rust 1.68 but using it with crates.io still required configuration. Users should see substantially improved performance when fetching information from crates.io index.

Also in Rust 1.70, two types have been stabilized for one-time initialization of shared data: OnceCell and its thread-safe counterpart, OnceLock. These can be used anywhere that immediate construction is not wanted and perhaps not even possible, such as non-const data in global variables.

A newly stabilized IsTerminal trait has a single method to determine if a given file descriptor or handle represents a terminal or TTY. This is another case of standardizing functionality that existed in external traits, such as atty and is-terminal, using the C library isatty function on Unix targets and similar functionality elsewhere. Version 1.70 also supports named levels of debug information. Stable and beta builds of Rust no longer will allow unstable test options, making them truly nightly-only, as documented. Rust 1.70 also stabilizes a number of APIs, such as NonZero*::MIN/MAX and BinaryHeap::retain.

The new features in Rust 1.69

Announced April 20, 2023, Rust 1.69 offers no new major features but contains many small improvements, including more than 3,000 commits from more than 500 contributors, the Rust release team said.

Rust 1.29 introduced the cargo fix subcommand to automatically fix some simple compiler warnings. Since then, the number of warnings that can be fixed automatically has continued to increase. Additionally, support for automatically fixing some simple Clippy warnings has been added. To draw attention to these capabilities, Cargo now will suggest running cargo fix or cargo clippy --fix when it detects warnings that are automatically fixable:

warning: unused import: `std::hash::Hash`
--> src/main.rs:1:5
|
1| use std::hash::Hash;
|     ^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default

warning: `foo` (bin "foo") generated 1 warning (run `cargo fix --bin "foo"` to apply 1 suggestion)

The full Cargo invocation shown here only is necessary to precisely apply fixes to a single crate. To apply fixes to all default members of a workspace, running cargo fix with no additional arguments is all that’s necessary.

Also in Rust 1.69, debug information is no longer included in build scripts by default. To boost compilation speed, Cargo now avoids emitting debug information in build scripts by default. There will be no visible effect when build scripts execute successfully. Finally, a number of APIs have been stabilized such as cstr::from_bytes_until_nul and core::ffi::FromBytesUntilNulError.

The new features in Rust 1.68

1 2 3 4 5 Page 1
Page 1 of 5