|
| 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 can use toolchain version for library version selection |
| 23 | + |
| 24 | +1.84.0 stabilizes the minimum supported Rust version (MSRV) aware resolver, |
| 25 | +which uses the declared [minimum supported Rust version](https://doc.rust-lang.org/cargo/reference/rust-version.html) from |
| 26 | +dependencies, if available, to improve package version selection. Rust version |
| 27 | +aware selection allows library authors to easily adopt newer Rust versions |
| 28 | +while providing library consumers a way to opt-in to using new package versions |
| 29 | +if they need compatibility with older toolchains. |
| 30 | + |
| 31 | +Library authors should start declaring their MSRV. Previously, bumping the |
| 32 | +version at each release to latest stable would force downstream consumers |
| 33 | +requiring an older Rust version to avoid running `cargo update` and/or require |
| 34 | +pinning the version of the library in use, but now those consumers will be able |
| 35 | +to automatically avoid pulling in new library versions if they want |
| 36 | +compatibility with an older toolchain. We expect this to provide more options |
| 37 | +for library authors for picking their preferred support strategy for Rust |
| 38 | +versions. |
| 39 | + |
| 40 | +The new resolver will be enabled by default with the 2024 edition (expected to |
| 41 | +stabilize in 1.85), but can be enabled as of 1.84 by setting |
| 42 | +`resolver.incompatible-rust-versions = "fallback"`. |
| 43 | + |
| 44 | +TODO: Should we talk about resolver v3 and/or recommend that as the path to enabling instead? |
| 45 | + |
| 46 | +Read [the documentation](https://doc.rust-lang.org/cargo/reference/resolver.html#rust-version) for more details. |
| 47 | + |
| 48 | +### Migration to a new trait solver begins |
| 49 | + |
| 50 | +The Rust compiler is in the process of moving to a new implementation for the |
| 51 | +trait solver. The next-generation trait solver is a reimplementation of a core |
| 52 | +component of Rust's type system. It is not only responsible for checking |
| 53 | +whether trait-bounds - e.g. `Vec<T>: Clone` - hold, but is also used by many |
| 54 | +other parts of the type system, such as normalization - figuring out the |
| 55 | +underlying type of `<Vec<T> as IntoIterator>::Item` - and equating types |
| 56 | +(checking whether T and U are the same). |
| 57 | + |
| 58 | +In 1.84, the new solver is used for checking coherence of trait impls. At a |
| 59 | +high level, coherence is responsible for ensuring that there is at most one |
| 60 | +implementation of a trait for a given type, including *globally* in not yet |
| 61 | +written or visible code in downstream crates from the current compilation. |
| 62 | + |
| 63 | +This stabilization does include some breaking changes, primarily by fixing some |
| 64 | +correctness issues with the old solver. Typically these will show up as new |
| 65 | +"conflicting implementations of trait ..." errors that were not previously |
| 66 | +reported. We expect instances of this to be rare based on evaluation of |
| 67 | +available code through [Crater], as the soundness holes in the previous solving |
| 68 | +engine used relatively esoteric code. It also improves our ability to detect |
| 69 | +where impls do *not* overlap, allowing more code to be written in some cases. |
| 70 | + |
| 71 | +For more details, see a [previous blog post](https://blog.rust-lang.org/inside-rust/2024/12/04/trait-system-refactor-initiative.html) |
| 72 | +and the [stabilization report](https://github.com/rust-lang/rust/pull/130654) |
| 73 | + |
| 74 | +[Crater]: https://github.com/rust-lang/crater/ |
| 75 | + |
| 76 | +### Strict provenance APIs stabilized |
| 77 | + |
| 78 | +Pointers (this includes values of reference type) in Rust have two components. |
| 79 | + |
| 80 | +* The pointer's "address" says where in memory the pointer is currently pointing. |
| 81 | +* The pointer's "provenance" says where and when the pointer is allowed to access memory. |
| 82 | + |
| 83 | +In 1.84, a number of standard library functions are stabilized to permit |
| 84 | +explicitly manipulating the address and provenance parts of pointers, avoiding |
| 85 | +integer-to-pointer casts to side-step the inherent ambiguity of that operation. |
| 86 | +This benefits compiler optimizations, and it is pretty much a requirement for |
| 87 | +using tools like [Miri](https://github.com/rust-lang/miri) and architectures |
| 88 | +like [CHERI](https://www.cl.cam.ac.uk/research/security/ctsrd/cheri/) that aim |
| 89 | +to detect and diagnose pointer misuse. |
| 90 | + |
| 91 | +We recommend that code generally be written against the strict provenance APIs |
| 92 | +when it needs to manipulate pointers. Rust code that doesn't cast integers to |
| 93 | +pointers is already staying within the bounds of strict provenance, though the |
| 94 | +usage of these APIs can make the programmer's intent clearer to tooling. |
| 95 | + |
| 96 | +See the [documentation](https://doc.rust-lang.org/nightly/std/ptr/index.html#strict-provenance) |
| 97 | +for more details on these APIs. For more background, [RFC 3559](https://rust-lang.github.io/rfcs/3559-rust-has-provenance.html) |
| 98 | +lays out the rationale for having provenance. |
| 99 | + |
| 100 | +### Stabilized APIs |
| 101 | + |
| 102 | +TODO, relnotes still in-progress for this section |
| 103 | + |
| 104 | +### Other changes |
| 105 | + |
| 106 | +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). |
| 107 | + |
| 108 | +## Contributors to 1.84.0 |
| 109 | + |
| 110 | +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