From fdf8fbf5ed9939addf20c42b32f45f2e51781e07 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Tue, 7 Apr 2026 22:54:59 -0400 Subject: [PATCH 1/6] Add initial 1.95.0 blog --- content/Rust-1.95.0.md | 118 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 content/Rust-1.95.0.md diff --git a/content/Rust-1.95.0.md b/content/Rust-1.95.0.md new file mode 100644 index 000000000..38e750dd3 --- /dev/null +++ b/content/Rust-1.95.0.md @@ -0,0 +1,118 @@ ++++ +path = "2026/04/16/Rust-1.95.0" +title = "Announcing Rust 1.95.0" +authors = ["The Rust Release Team"] +aliases = ["releases/1.95.0"] + +[extra] +release = true ++++ + +The Rust team is happy to announce a new version of Rust, 1.95.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.95.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.95.0](https://doc.rust-lang.org/stable/releases.html#version-1950-2026-04-16). + +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.95.0 stable + +### `cfg_select!` + +Rust 1.95 introduces a +[`cfg_select!`](https://doc.rust-lang.org/stable/std/macro.cfg_select.html) +macro that acts roughly similar to a compile-time `match` on `cfg`s. This +fulfills the same purpose as the popular +[`cfg-if`](https://crates.io/crates/cfg-if) crate, although with a different +syntax. `cfg_select!` expands to the right-hand side of the first arm whose +configuration predicate evaluates to `true`. Some examples: + +```rust +cfg_select! { + unix => { + fn foo() { /* unix specific functionality */ } + } + target_pointer_width = "32" => { + fn foo() { /* non-unix, 32-bit functionality */ } + } + _ => { + fn foo() { /* fallback implementation */ } + } +} + +let is_windows_str = cfg_select! { + windows => "windows", + _ => "not windows", +}; +``` + +### if-let guards in matches + +Rust 1.88 stabilized [let chains](https://blog.rust-lang.org/2025/06/26/Rust-1.88.0/#let-chains). Rust +1.95 brings that capability into match expressions, allowing for conditionals +based on pattern matching. + +```rust +match value { + Some(x) if let Ok(y) = compute(x) => { + // Both `x` and `y` are available here + println!("{}, {}", x, y); + } + _ => {} +} +``` + +Note that the compiler will not currently consider the patterns matched in `if +let` guards as part of the exhaustiveness evaluation of the overall match, just +like `if` guards. + +### `assert_matches!` + +When checking whether an expression matches a pattern, [`assert_matches!`] helps +avoid needing to write out a match statement or lower the pattern into a series +of conditional assertions. Unlike `assert!(matches!(...))`, this form will +print the `Debug` representation of the value if the assertion fails. + +Note that this macro is not placed in the prelude, and must either be imported +or written with a relative path (as done in the example below). + +```rust +std::assert_matches!(apples, Some(x) if x >= 100, "expected at least 100 apples"); +``` + +[`debug_assert_matches!`] is also stabilized in this release. + +[`assert_matches!]: https://doc.rust-lang.org/stable/std/macro.assert_matches.html +[`debug_assert_matches!]: https://doc.rust-lang.org/stable/std/macro.debug_assert_matches.html + +### Stabilized APIs + +See draft release notes, will get copied after those are non-draft: + + + +### Destabilized JSON target specs + +Rust 1.95 removes stable support for passing a custom target specification to +`rustc`. This should **not** affect any Rust users using a fully stable +toolchain, as building the standard library (including just `core`) already +required using nightly-only features. + +We are generally interested in use cases that require custom target +specifications. TODO: Do we want a link to an issue where people can comment +with a use case? + +### Other changes + +Check out everything that changed in [Rust](https://github.com/rust-lang/rust/releases/tag/1.95.0), [Cargo](https://doc.rust-lang.org/nightly/cargo/CHANGELOG.html#cargo-195-2026-04-16), and [Clippy](https://github.com/rust-lang/rust-clippy/blob/master/CHANGELOG.md#rust-195). + +## Contributors to 1.95.0 + +Many people came together to create Rust 1.95.0. We couldn't have done it without all of you. [Thanks!](https://thanks.rust-lang.org/rust/1.95.0/) + +[platform-support]: https://doc.rust-lang.org/rustc/platform-support.html From 64fb98ff365ddc35528cac6a32ba69c82c10e3b5 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Wed, 8 Apr 2026 20:46:23 -0400 Subject: [PATCH 2/6] Update content/Rust-1.95.0.md Co-authored-by: Jake Goulding --- content/Rust-1.95.0.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/Rust-1.95.0.md b/content/Rust-1.95.0.md index 38e750dd3..71aceecf6 100644 --- a/content/Rust-1.95.0.md +++ b/content/Rust-1.95.0.md @@ -87,8 +87,8 @@ std::assert_matches!(apples, Some(x) if x >= 100, "expected at least 100 apples" [`debug_assert_matches!`] is also stabilized in this release. -[`assert_matches!]: https://doc.rust-lang.org/stable/std/macro.assert_matches.html -[`debug_assert_matches!]: https://doc.rust-lang.org/stable/std/macro.debug_assert_matches.html +[`assert_matches!`]: https://doc.rust-lang.org/stable/std/macro.assert_matches.html +[`debug_assert_matches!`]: https://doc.rust-lang.org/stable/std/macro.debug_assert_matches.html ### Stabilized APIs From e5376c8dd7e25b59e5823022dd3d337bbdb9c05c Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Thu, 9 Apr 2026 21:30:11 -0400 Subject: [PATCH 3/6] Drop assert_matches, it's being removed from 1.95 --- content/Rust-1.95.0.md | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/content/Rust-1.95.0.md b/content/Rust-1.95.0.md index 71aceecf6..6cf5c2515 100644 --- a/content/Rust-1.95.0.md +++ b/content/Rust-1.95.0.md @@ -71,25 +71,6 @@ Note that the compiler will not currently consider the patterns matched in `if let` guards as part of the exhaustiveness evaluation of the overall match, just like `if` guards. -### `assert_matches!` - -When checking whether an expression matches a pattern, [`assert_matches!`] helps -avoid needing to write out a match statement or lower the pattern into a series -of conditional assertions. Unlike `assert!(matches!(...))`, this form will -print the `Debug` representation of the value if the assertion fails. - -Note that this macro is not placed in the prelude, and must either be imported -or written with a relative path (as done in the example below). - -```rust -std::assert_matches!(apples, Some(x) if x >= 100, "expected at least 100 apples"); -``` - -[`debug_assert_matches!`] is also stabilized in this release. - -[`assert_matches!`]: https://doc.rust-lang.org/stable/std/macro.assert_matches.html -[`debug_assert_matches!`]: https://doc.rust-lang.org/stable/std/macro.debug_assert_matches.html - ### Stabilized APIs See draft release notes, will get copied after those are non-draft: @@ -98,8 +79,8 @@ See draft release notes, will get copied after those are non-draft: ### Destabilized JSON target specs -Rust 1.95 removes stable support for passing a custom target specification to -`rustc`. This should **not** affect any Rust users using a fully stable +Rust 1.95 removes support on stable for passing a custom target specification +to `rustc`. This should **not** affect any Rust users using a fully stable toolchain, as building the standard library (including just `core`) already required using nightly-only features. From d199b02127df72bc19569d87867e23345a782060 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Fri, 10 Apr 2026 10:54:43 -0400 Subject: [PATCH 4/6] Add link to custom target tracking issue --- content/Rust-1.95.0.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/content/Rust-1.95.0.md b/content/Rust-1.95.0.md index 6cf5c2515..34a2b5163 100644 --- a/content/Rust-1.95.0.md +++ b/content/Rust-1.95.0.md @@ -84,9 +84,8 @@ to `rustc`. This should **not** affect any Rust users using a fully stable toolchain, as building the standard library (including just `core`) already required using nightly-only features. -We are generally interested in use cases that require custom target -specifications. TODO: Do we want a link to an issue where people can comment -with a use case? +We're also gathering use cases for custom targets on the [tracking issue](https://github.com/rust-lang/rust/issues/151528) +as we consider whether some form of this feature should eventually be stabilized. ### Other changes From 114352be464852807a45268a3a1398e2500685fd Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Mon, 13 Apr 2026 20:00:50 -0400 Subject: [PATCH 5/6] Add stabilized APIs --- content/Rust-1.95.0.md | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/content/Rust-1.95.0.md b/content/Rust-1.95.0.md index 34a2b5163..a04c74bae 100644 --- a/content/Rust-1.95.0.md +++ b/content/Rust-1.95.0.md @@ -73,9 +73,38 @@ like `if` guards. ### Stabilized APIs -See draft release notes, will get copied after those are non-draft: - - +- [`MaybeUninit<[T; N]>: From<[MaybeUninit; N]>`](https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#impl-From%3CMaybeUninit%3C%5BT;+N%5D%3E%3E-for-%5BMaybeUninit%3CT%3E;+N%5D) +- [`MaybeUninit<[T; N]>: AsRef<[MaybeUninit; N]>`](https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#impl-AsRef%3C%5BMaybeUninit%3CT%3E;+N%5D%3E-for-MaybeUninit%3C%5BT;+N%5D%3E) +- [`MaybeUninit<[T; N]>: AsRef<[MaybeUninit]>`](https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#impl-AsRef%3C%5BMaybeUninit%3CT%3E%5D%3E-for-MaybeUninit%3C%5BT;+N%5D%3E) +- [`MaybeUninit<[T; N]>: AsMut<[MaybeUninit; N]>`](https://doc.rust-lang.org/beta/std/mem/union.MaybeUninit.html#impl-AsMut%3C%5BMaybeUninit%3CT%3E;+N%5D%3E-for-MaybeUninit%3C%5BT;+N%5D%3E) +- [`MaybeUninit<[T; N]>: AsMut<[MaybeUninit]>`](https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#impl-AsMut%3C%5BMaybeUninit%3CT%3E%5D%3E-for-MaybeUninit%3C%5BT;+N%5D%3E) +- [`[MaybeUninit; N]: From>`](https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#impl-From%3C%5BMaybeUninit%3CT%3E;+N%5D%3E-for-MaybeUninit%3C%5BT;+N%5D%3E) +- [`Cell<[T; N]>: AsRef<[Cell; N]>`](https://doc.rust-lang.org/stable/std/cell/struct.Cell.html#impl-AsRef%3C%5BCell%3CT%3E;+N%5D%3E-for-Cell%3C%5BT;+N%5D%3E) +- [`Cell<[T; N]>: AsRef<[Cell]>`](https://doc.rust-lang.org/stable/std/cell/struct.Cell.html#impl-AsRef%3C%5BCell%3CT%3E%5D%3E-for-Cell%3C%5BT;+N%5D%3E) +- [`Cell<[T]>: AsRef<[Cell]>`](https://doc.rust-lang.org/stable/std/cell/struct.Cell.html#impl-AsRef%3C%5BCell%3CT%3E%5D%3E-for-Cell%3C%5BT%5D%3E) +- [`bool: TryFrom<{integer}>`](https://doc.rust-lang.org/stable/std/primitive.bool.html#impl-TryFrom%3Cu128%3E-for-bool) +- [`AtomicPtr::update`](https://doc.rust-lang.org/stable/std/sync/atomic/struct.AtomicPtr.html#method.update) +- [`AtomicPtr::try_update`](https://doc.rust-lang.org/stable/std/sync/atomic/struct.AtomicPtr.html#method.try_update) +- [`AtomicBool::update`](https://doc.rust-lang.org/stable/std/sync/atomic/struct.AtomicBool.html#method.update) +- [`AtomicBool::try_update`](https://doc.rust-lang.org/stable/std/sync/atomic/struct.AtomicBool.html#method.try_update) +- [`AtomicIn::update`](https://doc.rust-lang.org/stable/std/sync/atomic/struct.AtomicIsize.html#method.update) +- [`AtomicIn::try_update`](https://doc.rust-lang.org/stable/std/sync/atomic/struct.AtomicIsize.html#method.try_update) +- [`AtomicUn::update`](https://doc.rust-lang.org/stable/std/sync/atomic/struct.AtomicUsize.html#method.update) +- [`AtomicUn::try_update`](https://doc.rust-lang.org/stable/std/sync/atomic/struct.AtomicUsize.html#method.try_update) +- [`cfg_select!`](https://doc.rust-lang.org/stable/std/macro.cfg_select.html) +- [`mod core::range`](https://doc.rust-lang.org/stable/core/range/index.html) +- [`core::range::RangeInclusive`](https://doc.rust-lang.org/stable/core/range/struct.RangeInclusive.html) +- [`core::range::RangeInclusiveIter`](https://doc.rust-lang.org/stable/core/range/struct.RangeInclusiveIter.html) +- [`core::hint::cold_path`](https://doc.rust-lang.org/stable/core/hint/fn.cold_path.html) +- [`<*const T>::as_ref_unchecked`](https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.as_ref_unchecked) +- [`<*mut T>::as_ref_unchecked`](https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.as_ref_unchecked-1) +- [`<*mut T>::as_mut_unchecked`](https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.as_mut_unchecked) + +These previously stable APIs are now stable in const contexts: + +- [`fmt::from_fn`](https://doc.rust-lang.org/stable/std/fmt/fn.from_fn.html) +- [`ControlFlow::is_break`](https://doc.rust-lang.org/stable/core/ops/enum.ControlFlow.html#method.is_break) +- [`ControlFlow::is_continue`](https://doc.rust-lang.org/stable/core/ops/enum.ControlFlow.html#method.is_continue) ### Destabilized JSON target specs From 951a580d7530a5f0fd1ab6b0ae68099dec2eaac9 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Wed, 15 Apr 2026 21:42:30 -0400 Subject: [PATCH 6/6] Import extra stabilizations + fix channel typo --- content/Rust-1.95.0.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/content/Rust-1.95.0.md b/content/Rust-1.95.0.md index a04c74bae..404ea1d34 100644 --- a/content/Rust-1.95.0.md +++ b/content/Rust-1.95.0.md @@ -76,7 +76,7 @@ like `if` guards. - [`MaybeUninit<[T; N]>: From<[MaybeUninit; N]>`](https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#impl-From%3CMaybeUninit%3C%5BT;+N%5D%3E%3E-for-%5BMaybeUninit%3CT%3E;+N%5D) - [`MaybeUninit<[T; N]>: AsRef<[MaybeUninit; N]>`](https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#impl-AsRef%3C%5BMaybeUninit%3CT%3E;+N%5D%3E-for-MaybeUninit%3C%5BT;+N%5D%3E) - [`MaybeUninit<[T; N]>: AsRef<[MaybeUninit]>`](https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#impl-AsRef%3C%5BMaybeUninit%3CT%3E%5D%3E-for-MaybeUninit%3C%5BT;+N%5D%3E) -- [`MaybeUninit<[T; N]>: AsMut<[MaybeUninit; N]>`](https://doc.rust-lang.org/beta/std/mem/union.MaybeUninit.html#impl-AsMut%3C%5BMaybeUninit%3CT%3E;+N%5D%3E-for-MaybeUninit%3C%5BT;+N%5D%3E) +- [`MaybeUninit<[T; N]>: AsMut<[MaybeUninit; N]>`](https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#impl-AsMut%3C%5BMaybeUninit%3CT%3E;+N%5D%3E-for-MaybeUninit%3C%5BT;+N%5D%3E) - [`MaybeUninit<[T; N]>: AsMut<[MaybeUninit]>`](https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#impl-AsMut%3C%5BMaybeUninit%3CT%3E%5D%3E-for-MaybeUninit%3C%5BT;+N%5D%3E) - [`[MaybeUninit; N]: From>`](https://doc.rust-lang.org/stable/std/mem/union.MaybeUninit.html#impl-From%3C%5BMaybeUninit%3CT%3E;+N%5D%3E-for-MaybeUninit%3C%5BT;+N%5D%3E) - [`Cell<[T; N]>: AsRef<[Cell; N]>`](https://doc.rust-lang.org/stable/std/cell/struct.Cell.html#impl-AsRef%3C%5BCell%3CT%3E;+N%5D%3E-for-Cell%3C%5BT;+N%5D%3E) @@ -99,6 +99,17 @@ like `if` guards. - [`<*const T>::as_ref_unchecked`](https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.as_ref_unchecked) - [`<*mut T>::as_ref_unchecked`](https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.as_ref_unchecked-1) - [`<*mut T>::as_mut_unchecked`](https://doc.rust-lang.org/stable/std/primitive.pointer.html#method.as_mut_unchecked) +- [`Vec::push_mut`](https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#method.push_mut) +- [`Vec::insert_mut`](https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#method.insert_mut) +- [`VecDeque::push_front_mut`](https://doc.rust-lang.org/stable/std/collections/struct.VecDeque.html#method.push_front_mut) +- [`VecDeque::push_back_mut`](https://doc.rust-lang.org/stable/std/collections/struct.VecDeque.html#method.push_back_mut) +- [`VecDeque::insert_mut`](https://doc.rust-lang.org/stable/std/collections/struct.VecDeque.html#method.insert_mut) +- [`LinkedList::push_front_mut`](https://doc.rust-lang.org/stable/std/collections/struct.LinkedList.html#method.push_front_mut) +- [`LinkedList::push_back_mut`](https://doc.rust-lang.org/stable/std/collections/struct.LinkedList.html#method.push_back_mut) +- [`Layout::dangling_ptr`](https://doc.rust-lang.org/stable/std/alloc/struct.Layout.html#method.dangling_ptr) +- [`Layout::repeat`](https://doc.rust-lang.org/stable/std/alloc/struct.Layout.html#method.repeat) +- [`Layout::repeat_packed`](https://doc.rust-lang.org/stable/std/alloc/struct.Layout.html#method.repeat_packed) +- [`Layout::extend_packed`](https://doc.rust-lang.org/stable/std/alloc/struct.Layout.html#method.extend_packed) These previously stable APIs are now stable in const contexts: