-
Notifications
You must be signed in to change notification settings - Fork 293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.84.0 release post #1451
base: master
Are you sure you want to change the base?
1.84.0 release post #1451
Changes from 10 commits
bc1645b
9a6cc07
1326b7f
021bd3d
e43da1e
90aa1bb
332e566
a65cd81
8297755
fcb9e61
bff69e3
aed6b43
d932634
dea677e
51c8731
81c2640
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,140 @@ | ||||||||||||||
--- | ||||||||||||||
layout: post | ||||||||||||||
title: "Announcing Rust 1.84.0" | ||||||||||||||
author: The Rust Release Team | ||||||||||||||
release: true | ||||||||||||||
--- | ||||||||||||||
|
||||||||||||||
The Rust team is happy to announce a new version of Rust, 1.84.0. Rust is a programming language empowering everyone to build reliable and efficient software. | ||||||||||||||
|
||||||||||||||
If you have a previous version of Rust installed via `rustup`, you can get 1.84.0 with: | ||||||||||||||
|
||||||||||||||
```console | ||||||||||||||
$ rustup update stable | ||||||||||||||
``` | ||||||||||||||
|
||||||||||||||
If you don't have it already, you can [get `rustup`](https://www.rust-lang.org/install.html) from the appropriate page on our website, and check out the [detailed release notes for 1.84.0](https://doc.rust-lang.org/stable/releases.html#version-1840-2025-01-09). | ||||||||||||||
|
||||||||||||||
If you'd like to help us out by testing future releases, you might consider updating locally to use the beta channel (`rustup default beta`) or the nightly channel (`rustup default nightly`). Please [report](https://github.com/rust-lang/rust/issues/new/choose) any bugs you might come across! | ||||||||||||||
|
||||||||||||||
## What's in 1.84.0 stable | ||||||||||||||
|
||||||||||||||
### Cargo can use toolchain version for library version selection | ||||||||||||||
|
||||||||||||||
1.84.0 stabilizes the minimum supported Rust version (MSRV) aware resolver, | ||||||||||||||
Mark-Simulacrum marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
which uses the declared [minimum supported Rust version](https://doc.rust-lang.org/cargo/reference/rust-version.html) from | ||||||||||||||
dependencies, if available, to improve package version selection. Rust version | ||||||||||||||
Mark-Simulacrum marked this conversation as resolved.
Show resolved
Hide resolved
Mark-Simulacrum marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
aware selection allows library authors to easily adopt newer Rust versions | ||||||||||||||
while allowing consumers of the library to automatically use old versions | ||||||||||||||
if they need compatibility with older toolchains. | ||||||||||||||
Mark-Simulacrum marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
|
||||||||||||||
You can opt-in to the MSRV-aware resolver via [`.cargo/config.toml`](https://doc.rust-lang.org/cargo/reference/config.html#resolverincompatible-rust-versions): | ||||||||||||||
```toml | ||||||||||||||
[resolver] | ||||||||||||||
incompatible-rust-versions = "fallback" | ||||||||||||||
``` | ||||||||||||||
Then when adding a dependency: | ||||||||||||||
```console | ||||||||||||||
$ 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 [verifying the latest dependencies in CI](https://doc.rust-lang.org/cargo/guide/continuous-integration.html#verifying-latest-dependencies), you can override this: | ||||||||||||||
```console | ||||||||||||||
$ 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 | ||||||||||||||
``` | ||||||||||||||
|
||||||||||||||
Library authors should take the MSRV-aware resolver into account when deciding | ||||||||||||||
their policy on adopting new Rust toolchain features. Previously, a library | ||||||||||||||
adopting features from a new Rust toolchain would force downstream users of | ||||||||||||||
that library who have an older Rust version to either upgrade their toolchain | ||||||||||||||
or manually select an old version of the library compatible with their | ||||||||||||||
toolchain (and avoid running `cargo update`). Now, those users will be able to | ||||||||||||||
automatically use older library versions compatible with their older toolchain. | ||||||||||||||
In the future, we expect this to provide more flexibility for library authors | ||||||||||||||
to select their preferred support strategy for Rust versions, with the toolchain | ||||||||||||||
helping users on older toolchains avoid breakage. | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we want to provide more context on setting an MSRV, https://doc.rust-lang.org/cargo/reference/rust-version.html is where we have that documented and is fairly new so people are likely to have missed it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we link that already in the first sentence? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The difference is that is linking to it to provide context for the field while if we linked to it here, it would be to call out that guidance on MSRV policy exists. While the lead up sections are helpful, we could even link directly to https://doc.rust-lang.org/cargo/reference/rust-version.html#setting-and-updating-rust-version As I said, "if we want to provide more context".
Mark-Simulacrum marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
|
||||||||||||||
The new resolver will be enabled by default with the 2024 edition (expected to | ||||||||||||||
stabilize in 1.85), but can be enabled as of 1.84 by setting | ||||||||||||||
[`package.resolver = "3"`](https://doc.rust-lang.org/cargo/reference/resolver.html#resolver-versions) in the Cargo.toml manifest file, or | ||||||||||||||
Mark-Simulacrum marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
[`resolver.incompatible-rust-versions = "fallback"`](https://doc.rust-lang.org/cargo/reference/config.html#resolverincompatible-rust-versions) in the Cargo configuration file. | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (opening a new thread since #1451 (comment) is resolved and don't want this missed)
The emphasis should be on the config but with specific context. It is true that we generally prefer project state to be in the manifest and transient state to be in the config file. This would generally be a project default that people would want to create a happy path for contributors. However, if we only talk about the manifest, people will assume they can only use this feature if they bump their MSRV which would severely hamper the adoption of this feature as people with an MSRV are unlikely to bump it to gain access to this. We also need to acknowledge the config to ensure people know they can override this in CI for testing the latest dependencies. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not clear to me what changes you're specifically looking for here (especially with a bunch of the rewording already done) -- maybe you can suggest something specific? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The main focus of my comment is on emphasizing the config which is now done so people find a way to use this without bumping MSRV. It would be nice to find a way to tell people that they don't need to bump MSRV to use this feature but I can't think of a succinct enough way of doing it. We can probably mark this as resolved. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With the new example, I feel like we can trim this down
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the example doesn't reference Cargo.toml setting so this is probably still needed in the expanded form? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Saying that it can opt-in with the config is redundant with the earlier section. That just leaves I posted an alternative suggestion at https://github.com/rust-lang/blog.rust-lang.org/pull/1451/files#r1902126387 Feel free to take that or close both |
||||||||||||||
|
||||||||||||||
Read [the documentation](https://doc.rust-lang.org/cargo/reference/resolver.html#rust-version) for more details. | ||||||||||||||
|
||||||||||||||
### Migration to a new trait solver begins | ||||||||||||||
|
||||||||||||||
The Rust compiler is in the process of moving to a new implementation for the | ||||||||||||||
trait solver. The next-generation trait solver is a reimplementation of a core | ||||||||||||||
component of Rust's type system. It is not only responsible for checking | ||||||||||||||
whether trait-bounds - e.g. `Vec<T>: Clone` - hold, but is also used by many | ||||||||||||||
other parts of the type system, such as normalization - figuring out the | ||||||||||||||
underlying type of `<Vec<T> as IntoIterator>::Item` - and equating types | ||||||||||||||
(checking whether `T` and `U` are the same). | ||||||||||||||
|
||||||||||||||
In 1.84, the new solver is used for checking coherence of trait impls. At a | ||||||||||||||
high level, coherence is responsible for ensuring that there is at most one | ||||||||||||||
implementation of a trait for a given type, including *globally* in not yet | ||||||||||||||
written or visible code in downstream crates from the current compilation. | ||||||||||||||
|
||||||||||||||
This stabilization does include some breaking changes, primarily by fixing some | ||||||||||||||
correctness issues with the old solver. Typically these will show up as new | ||||||||||||||
"conflicting implementations of trait ..." errors that were not previously | ||||||||||||||
reported. We expect instances of this to be rare based on evaluation of | ||||||||||||||
available code through [Crater], as the soundness holes in the previous solving | ||||||||||||||
engine used relatively esoteric code. It also improves our ability to detect | ||||||||||||||
where impls do *not* overlap, allowing more code to be written in some cases. | ||||||||||||||
|
||||||||||||||
For more details, see a [previous blog post](https://blog.rust-lang.org/inside-rust/2024/12/04/trait-system-refactor-initiative.html) | ||||||||||||||
and the [stabilization report](https://github.com/rust-lang/rust/pull/130654) | ||||||||||||||
|
||||||||||||||
[Crater]: https://github.com/rust-lang/crater/ | ||||||||||||||
|
||||||||||||||
### Strict provenance APIs | ||||||||||||||
|
||||||||||||||
In Rust, [pointers are not simply an "integer" or | ||||||||||||||
"address"](https://rust-lang.github.io/rfcs/3559-rust-has-provenance.html). For | ||||||||||||||
instance, a "use after free" is undefined behavior even if you "get lucky" and the freed memory gets | ||||||||||||||
reallocated before your read/write. As another example, writing | ||||||||||||||
through a pointer derived from an `&i32` reference is undefined behavior, even | ||||||||||||||
if writing to the same address via a different pointer is legal. The underlying | ||||||||||||||
pattern here is that *the way a pointer is computed matters*, not just the | ||||||||||||||
address that results from this computation. For this reason, we say that | ||||||||||||||
pointers have **provenance**: to fully characterize pointer-related undefined | ||||||||||||||
behavior in Rust, we have to know not only the address the pointer points to, | ||||||||||||||
but also track which other pointer(s) it is "derived from". | ||||||||||||||
|
||||||||||||||
Most of the time, programmers do not need to worry much about provenance, and | ||||||||||||||
it is very clear how a pointer got derived. However, when casting pointers to | ||||||||||||||
integers and back, the provenance of the resulting pointer is underspecified. | ||||||||||||||
With this release, Rust is adding a set of APIs that can in many cases replace | ||||||||||||||
the use of integer-pointer-casts, and therefore avoid the ambiguities inherent | ||||||||||||||
to such casts. In particular, the pattern of using the lowest bits of an | ||||||||||||||
aligned pointer to store extra information can now be implemented without ever | ||||||||||||||
casting a pointer to an integer or back. This makes the code easier to reason | ||||||||||||||
about, easier to analyze for the compiler, and also benefits tools like | ||||||||||||||
[Miri](https://github.com/rust-lang/miri) and architectures like | ||||||||||||||
[CHERI](https://www.cl.cam.ac.uk/research/security/ctsrd/cheri/) that aim to | ||||||||||||||
detect and diagnose pointer misuse. | ||||||||||||||
|
||||||||||||||
For more details, see the standard library [documentation on provenance](https://doc.rust-lang.org/std/ptr/index.html#provenance). | ||||||||||||||
|
||||||||||||||
### Stabilized APIs | ||||||||||||||
|
||||||||||||||
TODO, relnotes still in-progress for this section | ||||||||||||||
|
||||||||||||||
### Other changes | ||||||||||||||
|
||||||||||||||
Check out everything that changed in [Rust](https://github.com/rust-lang/rust/releases/tag/1.84.0), [Cargo](https://github.com/rust-lang/cargo/blob/master/CHANGELOG.md#cargo-184-2025-01-09), and [Clippy](https://github.com/rust-lang/rust-clippy/blob/master/CHANGELOG.md#rust-184). | ||||||||||||||
|
||||||||||||||
## Contributors to 1.84.0 | ||||||||||||||
|
||||||||||||||
Many people came together to create Rust 1.84.0. We couldn't have done it without all of you. [Thanks!](https://thanks.rust-lang.org/rust/1.84.0/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
“A toolchain”? “The toolchain”?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This header isn't ideal IMO -- but I'm not sure adding an article will help. It's hard for me to succinctly describe what this feature is without using jargon (e.g., MSRV), especially since it's not on by default.