Skip to content

Commit ceca203

Browse files
authored
Merge pull request #1451 from Mark-Simulacrum/blog-1.84.0
1.84.0 release post
2 parents f80cbee + 0f4dc87 commit ceca203

File tree

1 file changed

+180
-0
lines changed

1 file changed

+180
-0
lines changed

posts/2025-01-09-Rust-1.84.0.md

Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
---
2+
layout: post
3+
title: "Announcing Rust 1.84.0"
4+
author: The Rust Release Team
5+
release: true
6+
---
7+
8+
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.
9+
10+
If you have a previous version of Rust installed via `rustup`, you can get 1.84.0 with:
11+
12+
```console
13+
$ rustup update stable
14+
```
15+
16+
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).
17+
18+
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!
19+
20+
## What's in 1.84.0 stable
21+
22+
### Cargo considers Rust versions for dependency version selection
23+
24+
1.84.0 stabilizes the minimum supported Rust version (MSRV) aware resolver,
25+
which prefers dependency versions compatible with the project's declared
26+
[MSRV](https://doc.rust-lang.org/cargo/reference/rust-version.html).
27+
With MSRV-aware version selection, the toil is reduced for maintainers to
28+
support older toolchains by not needing to manually select older versions for
29+
each dependency.
30+
31+
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):
32+
33+
```toml
34+
[resolver]
35+
incompatible-rust-versions = "fallback"
36+
```
37+
38+
Then when adding a dependency:
39+
40+
```console
41+
$ cargo add clap
42+
Updating crates.io index
43+
warning: ignoring clap@4.5.23 (which requires rustc 1.74) to maintain demo's rust-version of 1.60
44+
Adding clap v4.0.32 to dependencies
45+
Updating crates.io index
46+
Locking 33 packages to latest Rust 1.60 compatible versions
47+
Adding clap v4.0.32 (available: v4.5.23, requires Rust 1.74)
48+
```
49+
50+
When [verifying the latest dependencies in CI](https://doc.rust-lang.org/cargo/guide/continuous-integration.html#verifying-latest-dependencies), you can override this:
51+
52+
```console
53+
$ CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS=allow cargo update
54+
Updating crates.io index
55+
Locking 12 packages to latest compatible versions
56+
Updating clap v4.0.32 -> v4.5.23
57+
```
58+
59+
You can also opt-in by setting [`package.resolver = "3"`](https://doc.rust-lang.org/cargo/reference/resolver.html#resolver-versions) in the Cargo.toml manifest file though that will require raising your MSRV to 1.84. The new resolver will be enabled by default for projects using the 2024 edition
60+
(which will stabilize in 1.85).
61+
62+
This gives library authors more flexibility when deciding
63+
their policy on adopting new Rust toolchain features. Previously, a library
64+
adopting features from a new Rust toolchain would force downstream users of
65+
that library who have an older Rust version to either upgrade their toolchain
66+
or manually select an old version of the library compatible with their
67+
toolchain (and avoid running `cargo update`). Now, those users will be able to
68+
automatically use older library versions compatible with their older toolchain.
69+
70+
See the [documentation](https://doc.rust-lang.org/cargo/reference/rust-version.html#setting-and-updating-rust-version) for more considerations when deciding on an MSRV policy.
71+
72+
### Migration to the new trait solver begins
73+
74+
The Rust compiler is in the process of moving to a new implementation for the
75+
trait solver. The next-generation trait solver is a reimplementation of a core
76+
component of Rust's type system. It is not only responsible for checking
77+
whether trait-bounds - e.g. `Vec<T>: Clone` - hold, but is also used by many
78+
other parts of the type system, such as normalization - figuring out the
79+
underlying type of `<Vec<T> as IntoIterator>::Item` - and equating types
80+
(checking whether `T` and `U` are the same).
81+
82+
In 1.84, the new solver is used for checking coherence of trait impls. At a
83+
high level, coherence is responsible for ensuring that there is at most one
84+
implementation of a trait for a given type while considering not yet written
85+
or visible code from other crates.
86+
87+
This stabilization fixes a few mostly theoretical correctness issues of the
88+
old implementation, resulting in potential "conflicting implementations of trait ..."
89+
errors that were not previously reported. We expect the affected patterns to be
90+
very rare based on evaluation of available code through [Crater]. The stabilization
91+
also improves our ability to prove that impls do *not* overlap, allowing more code
92+
to be written in some cases.
93+
94+
For more details, see a [previous blog post](https://blog.rust-lang.org/inside-rust/2024/12/04/trait-system-refactor-initiative.html)
95+
and the [stabilization report](https://github.com/rust-lang/rust/pull/130654).
96+
97+
[Crater]: https://github.com/rust-lang/crater/
98+
99+
### Strict provenance APIs
100+
101+
In Rust, [pointers are not simply an "integer" or
102+
"address"](https://rust-lang.github.io/rfcs/3559-rust-has-provenance.html). For
103+
instance, a "use after free" is undefined behavior even if you "get lucky" and the freed memory gets
104+
reallocated before your read/write. As another example, writing
105+
through a pointer derived from an `&i32` reference is undefined behavior, even
106+
if writing to the same address via a different pointer is legal. The underlying
107+
pattern here is that *the way a pointer is computed matters*, not just the
108+
address that results from this computation. For this reason, we say that
109+
pointers have **provenance**: to fully characterize pointer-related undefined
110+
behavior in Rust, we have to know not only the address the pointer points to,
111+
but also track which other pointer(s) it is "derived from".
112+
113+
Most of the time, programmers do not need to worry much about provenance, and
114+
it is very clear how a pointer got derived. However, when casting pointers to
115+
integers and back, the provenance of the resulting pointer is underspecified.
116+
With this release, Rust is adding a set of APIs that can in many cases replace
117+
the use of integer-pointer-casts, and therefore avoid the ambiguities inherent
118+
to such casts. In particular, the pattern of using the lowest bits of an
119+
aligned pointer to store extra information can now be implemented without ever
120+
casting a pointer to an integer or back. This makes the code easier to reason
121+
about, easier to analyze for the compiler, and also benefits tools like
122+
[Miri](https://github.com/rust-lang/miri) and architectures like
123+
[CHERI](https://www.cl.cam.ac.uk/research/security/ctsrd/cheri/) that aim to
124+
detect and diagnose pointer misuse.
125+
126+
For more details, see the standard library [documentation on provenance](https://doc.rust-lang.org/std/ptr/index.html#provenance).
127+
128+
### Stabilized APIs
129+
130+
- [`Ipv6Addr::is_unique_local`](https://doc.rust-lang.org/stable/core/net/struct.Ipv6Addr.html#method.is_unique_local)
131+
- [`Ipv6Addr::is_unicast_link_local`](https://doc.rust-lang.org/stable/core/net/struct.Ipv6Addr.html#method.is_unicast_link_local)
132+
- [`core::ptr::with_exposed_provenance`](https://doc.rust-lang.org/stable/core/ptr/fn.with_exposed_provenance.html)
133+
- [`core::ptr::with_exposed_provenance_mut`](https://doc.rust-lang.org/stable/core/ptr/fn.with_exposed_provenance_mut.html)
134+
- [`<ptr>::addr`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.addr)
135+
- [`<ptr>::expose_provenance`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.expose_provenance)
136+
- [`<ptr>::with_addr`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.with_addr)
137+
- [`<ptr>::map_addr`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.map_addr)
138+
- [`<int>::isqrt`](https://doc.rust-lang.org/stable/core/primitive.i32.html#method.isqrt)
139+
- [`<int>::checked_isqrt`](https://doc.rust-lang.org/stable/core/primitive.i32.html#method.checked_isqrt)
140+
- [`<uint>::isqrt`](https://doc.rust-lang.org/stable/core/primitive.u32.html#method.isqrt)
141+
- [`NonZero::isqrt`](https://doc.rust-lang.org/stable/core/num/struct.NonZero.html#impl-NonZero%3Cu128%3E/method.isqrt)
142+
- [`core::ptr::without_provenance`](https://doc.rust-lang.org/stable/core/ptr/fn.without_provenance.html)
143+
- [`core::ptr::without_provenance_mut`](https://doc.rust-lang.org/stable/core/ptr/fn.without_provenance_mut.html)
144+
- [`core::ptr::dangling`](https://doc.rust-lang.org/stable/core/ptr/fn.dangling.html)
145+
- [`core::ptr::dangling_mut`](https://doc.rust-lang.org/stable/core/ptr/fn.dangling_mut.html)
146+
- [`Pin::as_deref_mut`](https://doc.rust-lang.org/stable/core/pin/struct.Pin.html#method.as_deref_mut)
147+
148+
These APIs are now stable in const contexts
149+
150+
- [`AtomicBool::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicBool.html#method.from_ptr)
151+
- [`AtomicPtr::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicPtr.html#method.from_ptr)
152+
- [`AtomicU8::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicU8.html#method.from_ptr)
153+
- [`AtomicU16::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicU16.html#method.from_ptr)
154+
- [`AtomicU32::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicU32.html#method.from_ptr)
155+
- [`AtomicU64::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicU64.html#method.from_ptr)
156+
- [`AtomicUsize::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicUsize.html#method.from_ptr)
157+
- [`AtomicI8::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicI8.html#method.from_ptr)
158+
- [`AtomicI16::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicI16.html#method.from_ptr)
159+
- [`AtomicI32::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicI32.html#method.from_ptr)
160+
- [`AtomicI64::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicI64.html#method.from_ptr)
161+
- [`AtomicIsize::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicIsize.html#method.from_ptr)
162+
- [`<ptr>::is_null`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.is_null-1)
163+
- [`<ptr>::as_ref`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.as_ref-1)
164+
- [`<ptr>::as_mut`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.as_mut)
165+
- [`Pin::new`](https://doc.rust-lang.org/stable/core/pin/struct.Pin.html#method.new)
166+
- [`Pin::new_unchecked`](https://doc.rust-lang.org/stable/core/pin/struct.Pin.html#method.new_unchecked)
167+
- [`Pin::get_ref`](https://doc.rust-lang.org/stable/core/pin/struct.Pin.html#method.get_ref)
168+
- [`Pin::into_ref`](https://doc.rust-lang.org/stable/core/pin/struct.Pin.html#method.into_ref)
169+
- [`Pin::get_mut`](https://doc.rust-lang.org/stable/core/pin/struct.Pin.html#method.get_mut)
170+
- [`Pin::get_unchecked_mut`](https://doc.rust-lang.org/stable/core/pin/struct.Pin.html#method.get_unchecked_mut)
171+
- [`Pin::static_ref`](https://doc.rust-lang.org/stable/core/pin/struct.Pin.html#method.static_ref)
172+
- [`Pin::static_mut`](https://doc.rust-lang.org/stable/core/pin/struct.Pin.html#method.static_mut)
173+
174+
### Other changes
175+
176+
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).
177+
178+
## Contributors to 1.84.0
179+
180+
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/)

0 commit comments

Comments
 (0)