Say hello to rust 1.84.0

The Rust team is pleased to announce a new version of Rust, 1.84.0. Rust is a programming language allowing everyone to create reliable and effective software.
If you have a previous version of Rust installed via rustup
You can get 1.84.0 with:
$ rustup update stable
If you don't already have it, you can get rustup
From the appropriate page of our website and consult the detailed version notes for 1.84.0.
If you want to help us by testing future versions, you might consider updating locally to use the beta channel (rustup default beta
) or the night chain (rustup default nightly
). Please point out all the bugs you may meet!
What is in 1.84.0 stable
Freight considers rust versions for selecting dependence versions
1.84.0 Stabilizes the meeting resolver of the Rust (MSRV) version supported minimal, which prefers the versions of dependence compatible with the declared MSRV of the project. With the selection of versions of MSRV-Aware, the work is reduced for maintainers in order to support the old tool channels by not needing to manually select the old versions for each dependence.
You can opt for the Aware MSRV resolver via .cargo/config.toml
::
[resolver]
incompatible-rust-versions = "fallback"
Then when adding a dependence:
$ cargo add clap
Updating crates.io index
warning: ignoring [email protected] (which requires rustc 1.74) to maintain demo's rust-version of 1.60
Adding clap v4.0.32 to dependencies
Updating crates.io index
Locking 33 packages to latest Rust 1.60 compatible versions
Adding clap v4.0.32 (available: v4.5.23, requires Rust 1.74)
When checking the latest outbuildings in CI, you can replace this:
$ CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS=allow cargo update
Updating crates.io index
Locking 12 packages to latest compatible versions
Updating clap v4.0.32 -> v4.5.23
You can also oppose by defining package.resolver = "3"
In the Cargo.Toml manifest file, this will require increase your MSRV to 1.84. The new resolver will be activated by default for projects using the 2024 edition (which will stabilize in 1.85).
This gives the authors of the library more flexibility when the decision of their policy on the adoption of new features of the rust tool chain. Previously, a library adopting features of a new rust tool channel would force users downstream of this library which have an old rust version to upgrade their tool chain or manually select an old version of the library compatible with their tool chain (and avoid executing cargo update
). From now on, these users will be able to automatically use older library versions compatible with their old tool chain.
See the documentation for more considerations during the decision of an MSRV policy.
Migration to the new line of lines begins
The rust compiler is moving to a new implementation for the draft solver. The new generation lines solver is a re -implementation of a central component of the Rust type system. He is not only responsible for checking whether the features – for example Vec
– hold, but is also used by many other parts of the type system, such as standardization – determine the underlying type of
– and the types of assimilation (check if T
And U
are the same).
In 1.84, the new solver is used to check the consistency of the draft implants. At a high level, consistency is responsible for ensuring that there is at most an implementation of a line for a given type while considering the unwritten or visible code from other cases.
This stabilization solves some mainly theoretical accuracy problems of the old implementation, which leads to potential “line -up …” which had not been reported before. We expect the assigned models to be very rare depending on the evaluation of the code available via Crater. Stabilization also improves our ability to prove that the implages not Having overlap, allowing more code to write in some cases.
For more details, see a previous blog article and the stabilization report.
Strict provenance API
In Rust, pointers are not just a “integer” or “” address “. For example,” use after free “is an unsustainable behavior even if you are” lucky “and that the released memory is reassigned before your reading / writing. As another example, writing through a pointer derived from a &i32
The reference is an undefined behavior, even if the writing at the same address via a different pointer is legal. The underlying model here is that The way a pointer is calculatedNot just the address that results from this calculation. For this reason, we say that pointers have provenance: To fully characterize the undefined behavior linked to the pointer in rust, we must know not only the address to which the pointer points, but also follow which pointer (s) it is “derived from”.
Most of the time, programmers do not have to worry a lot about the provenance, and it is very clear how a pointer has been derived. However, when you throw pointers to integers and back, the provenance of the resulting pointer is sub-special. With this version, Rust adds a set of APIs which can in many cases replace the use of whole-point castes and therefore avoid the ambiguities inherent in such molds.
In particular, the lowest bits use model of an aligned pointer to store additional information can now be implemented without ever launching a pointer on an integer or back. This makes the code easier to reason, easier to analyze for the compiler, and also benefits tools like Miri and architectures like Cheri which aim to detect and diagnose poor use of the pointer.
For more details, see the standard library documentation on the provenance.
Stabilized API
Ipv6Addr::is_unique_local
Ipv6Addr::is_unicast_link_local
core::ptr::with_exposed_provenance
core::ptr::with_exposed_provenance_mut
::addr ::expose_provenance ::with_addr ::map_addr ::isqrt ::checked_isqrt ::isqrt NonZero::isqrt
core::ptr::without_provenance
core::ptr::without_provenance_mut
core::ptr::dangling
core::ptr::dangling_mut
Pin::as_deref_mut
These APIs are now stable in Contexts Const
AtomicBool::from_ptr
AtomicPtr::from_ptr
AtomicU8::from_ptr
AtomicU16::from_ptr
AtomicU32::from_ptr
AtomicU64::from_ptr
AtomicUsize::from_ptr
AtomicI8::from_ptr
AtomicI16::from_ptr
AtomicI32::from_ptr
AtomicI64::from_ptr
AtomicIsize::from_ptr
::is_null ::as_ref ::as_mut Pin::new
Pin::new_unchecked
Pin::get_ref
Pin::into_ref
Pin::get_mut
Pin::get_unchecked_mut
Pin::static_ref
Pin::static_mut
Other changes
Discover everything that has changed in rust, cargo and clippy.
Contributors to 1.84.0
Many people have come together to create Rust 1.84.0. We could not have done it without all of you. THANKS!
The Rust Liberation team
Also published here
Photo of Pablo Gentile on UNCLASH