Rust versions / 1.96
Rust release · May 28, 2026
Rust 1.96: what's new, what was stabilized
Short answerRust 1.96 was released on May 28, 2026: 11 newly stable APIs (assert_matches!, debug_assert_matches!, From<T> for AssertUnwindSafe<T>, From<T> for LazyCell<T, F>, ...); 14 compatibility notes that can affect existing code. Point release: 1.96.1 (Jun 30, 2026).
← Rust 1.95All versionsRust 1.97 →
11 APIs stabilized
assert_matches!, debug_assert_matches!, From<T> for AssertUnwindSafe<T>, From<T> for LazyCell<T, F>, From<T> for LazyLock<T, F>, core::range::RangeToInclusive, core::range::RangeToInclusiveIter, core::range::RangeFrom, core::range::RangeFromIter, core::range::Range, core::range::RangeIter
Can it break my build?
The release lists these compatibility notes. Most only affect rare code, but read them before you raise your toolchain in CI:
- [Fix layout of
#[repr(Int)]enums in some edge cases involving fields of uninhabited zero-sized types](https://github.com/rust-lang/rust/pull/146989) - Prevent unsize-coercing into
Pin<Foo>whereFoodoesn't implementDeref. Some such coercions were previously allowed, but produce a type with no useful public API. - rustc: Stop passing
--allow-undefinedon wasm targets - [Gate the accidentally stabilized
#![reexport_test_harness_main]attribute](https://github.com/rust-lang/rust/pull/152210) - Error on return-position-impl-trait-in-traits whose types are too private
- Report the
uninhabited_staticlint in dependencies and make it deny-by-default - Distributed builds now contain non-split debuginfo for windows-gnu
- Check const generic arguments are correctly typed in more positions
- Remove
-Csoft-float - [Importing structs with
::{self [as name]}, e.g.,struct S {}; use S::{self as Other};, is now no longer permitted because{self}imports require a module parent.](https://github.com/rust-lang/rust/pull/152996) - For
export_name,link_name, andlink_sectionattributes, if multiple of the same attribute is present, the first one now takes precedence. - Update the minimum external LLVM to 21
- On
avrtargets, C'sdoubletype is 32-bit by default, so changec_doubletof32onavrtargets to match. This is a breaking change, but necessary to makec_doublematch C's double. BTreeMap::append()was optimized, which may now cause panics for types with incorrectOrdimpls
Use it
rustup update stable # get the newest release
rustup install 1.96 # or exactly this one
rustup override set 1.96 # pin a project to itTo require at least this version from users of your crate, set rust-version = "1.96" under [package] in Cargo.toml. Cargo then refuses to build it on older compilers with a clear message, and with resolver 3 (the default on the 2024 edition, Rust 1.85+) it also prefers dependency versions that support it.
Full release notes
Language
- Allow passing
exprmetavariable tocfg - Always coerce never types in tuple expressions
- Avoid incorrect inference guidance of function arguments in rare cases
- Support s390x vector registers in inline assembly
- Allow using constants of type
ManuallyDropas patterns (fixing a regression introduced in 1.94.0)
<a id="1.96.0-Compiler"></a>
Compiler
- Enable link relaxation feature for LoongArch Linux targets
- Update
riscv64gc-unknown-fuchsiabaseline to RVA22 + vector
<a id="1.96.0-Libraries"></a>
Libraries
- Support iterating over ranges of
NonZerointegers - refactor 'valid for read/write' definition: exclude null; add that as an exception on individual methods instead
- Fix SGX delayed host lookup via ToSocketAddr
<a id="1.96.0-Stabilized-APIs"></a>
Stabilized APIs
assert_matches!debug_assert_matches!From<T> for AssertUnwindSafe<T>From<T> for LazyCell<T, F>From<T> for LazyLock<T, F>core::range::RangeToInclusivecore::range::RangeToInclusiveItercore::range::RangeFromcore::range::RangeFromItercore::range::Rangecore::range::RangeIter
<a id="1.96.0-Cargo"></a>
Cargo
- Allow a dependency to specify both a git repository and an alternate registry. Just like with crates.io, the git repository will be used locally, but the registry version will be used when published.
- Added
target.'cfg(..)'.rustdocflagssupport in configuration. - Fixed CVE-2026-5222 and CVE-2026-5223.
<a id="1.96-Rustdoc"></a>
Rustdoc
- Deprecation notes are now rendered like any other documentation. Previously they used the css
white-space: pre-wrap;property and stripped any<p>elements from the rendered html, however this caused issues and unintuitive behavior. The new behavior should be more predictable, however some multi-line deprecation notes will now be rendered as as single lines. If this is undesirable, you can use the standard markdown method of forcing a linebreak, which is two spaces followed by a newline ("\n"). - Don't emit rustdoc
missing_doc_code_exampleslint on impl items - Separate methods and associated functions in sidebar
<a id="1.96.0-Compatibility-Notes"></a>
Compatibility Notes
- [Fix layout of
#[repr(Int)]enums in some edge cases involving fields of uninhabited zero-sized types](https://github.com/rust-lang/rust/pull/146989) - Prevent unsize-coercing into
Pin<Foo>whereFoodoesn't implementDeref. Some such coercions were previously allowed, but produce a type with no useful public API. - rustc: Stop passing
--allow-undefinedon wasm targets - [Gate the accidentally stabilized
#![reexport_test_harness_main]attribute](https://github.com/rust-lang/rust/pull/152210) - Error on return-position-impl-trait-in-traits whose types are too private
- Report the
uninhabited_staticlint in dependencies and make it deny-by-default - Distributed builds now contain non-split debuginfo for windows-gnu This appears to improve the quality of backtraces. This change has no effect on the defaults for the output of rustc/cargo on these targets.
- Check const generic arguments are correctly typed in more positions
- Remove
-Csoft-float - [Importing structs with
::{self [as name]}, e.g.,struct S {}; use S::{self as Other};, is now no longer permitted because{self}imports require a module parent.](https://github.com/rust-lang/rust/pull/152996) - For
export_name,link_name, andlink_sectionattributes, if multiple of the same attribute is present, the first one now takes precedence. - Update the minimum external LLVM to 21
- On
avrtargets, C'sdoubletype is 32-bit by default, so changec_doubletof32onavrtargets to match. This is a breaking change, but necessary to makec_doublematch C's double. BTreeMap::append()was optimized, which may now cause panics for types with incorrectOrdimpls
<a id="1.96.0-Internal-Changes"></a>
Internal Changes
These changes do not affect any public interfaces of Rust, but they represent significant improvements to the performance or internals of rustc and related tools.
- JSON targets:
aarch64softfloat targets now have to haverustc_abiset to"softfloat" - target specs: stricter checks for LLVM ABI values, and correlate that with
cfg(target_abi)
1.96.1 (Jun 30, 2026)
<a id="1.96.1"></a>
Release notes from the Rust project's RELEASES.md (MIT or Apache-2.0); summaries above are ours.
Up next
Next releaseRust 1.97Released Jul 9, 2026.Read it next →Also worth your time
Did this answer your question?