Quick Facts
- Category: Technology
- Published: 2026-05-08 00:01:23
- Go Language Rolls Out Revolutionary Stack Allocation Optimization for Slices
- How to Enable DNS Privacy on Windows 11: A Step-by-Step Guide
- Beyond Content Filtering: How TealTiger v1.2 Enforces AI Agent Governance with Deterministic Policy Evaluation
- Python 3.14 Reaches Final Beta: Free-Threaded Mode, Deferred Annotations, and More
- Replit's CEO on Independence, Competition, and the $60 Billion Cursor Question
Overview of Rust 1.95.0
The Rust team is pleased to announce the release of version 1.95.0 of the Rust programming language. This update continues Rust's mission to empower developers to build reliable and efficient software. If you already have Rust installed via rustup, you can upgrade by running:

$ rustup update stable
If you're new to Rust, visit the official website to install rustup and get started. For those interested in testing upcoming features, consider switching to the beta or nightly channels using rustup default beta or rustup default nightly. Please report any bugs you encounter to help improve future releases.
Key New Features in Rust 1.95.0
The cfg_select! Macro
One of the headline additions in this release is the cfg_select! macro, which provides a compile-time selection mechanism similar to a match statement but for configuration predicates. It works much like the popular cfg-if crate, though with a different syntax. The macro expands to the right-hand side of the first arm whose condition evaluates to true.
Here's an example showing platform-specific function implementations:
cfg_select! {
unix => {
fn foo() { /* unix specific functionality */ }
}
target_pointer_width = "32" => {
fn foo() { /* non-unix, 32-bit functionality */ }
}
_ => {
fn foo() { /* fallback implementation */ }
}
}
You can also use it in expressions:
let is_windows_str = cfg_select! {
windows => "windows",
_ => "not windows",
};
If-Let Guards in Match Expressions
Building on the let chains stabilized in Rust 1.88, version 1.95.0 introduces if-let guards within match arms. This allows you to add a conditional pattern match directly inside a match arm, making code more concise and expressive.
match value {
Some(x) if let Ok(y) = compute(x) => {
// Both `x` and `y` are available here
println!("{}, {}", x, y);
}
_ => {}
}
Note that the compiler currently does not consider the patterns in if-let guards as part of the exhaustiveness check of the overall match, similar to regular if guards. This feature enhances flexibility without breaking existing code.
Stabilized APIs in Rust 1.95.0
This release brings a wide range of API stabilizations that improve ergonomics and safety. Below are the highlights grouped by category.
MaybeUninit Array Conversions
Several From, AsRef, and AsMut implementations have been stabilized for MaybeUninit<[T; N]> and [MaybeUninit<T>; N], making it easier to work with uninitialized arrays safely.
Cell Array Access
New AsRef implementations for Cell<[T; N]> and Cell<[T]> allow borrowing the inner array or slice immutably, simplifying code that uses interior mutability.
Bool Conversion from Integer
A TryFrom<{integer}> implementation for bool is now stable, enabling fallible conversion from integers with clear semantics.
Atomic Operations
New update and try_update methods have been added for AtomicPtr, AtomicBool, and the generic atomic integer types. These provide a concise way to atomically modify values.
New Modules and Functions
core::range: A new module withRangeInclusiveandRangeInclusiveItertypes, offering more ergonomic range handling.core::hint::cold_path: A new hint function to mark rarely executed code paths, aiding compiler optimization.- Pointer unchecked methods:
<*const T>::as_ref_unchecked,<*mut T>::as_ref_unchecked, and<*mut T>::as_mut_uncheckedallow unchecked conversion from raw pointers to references.
Collection Extensions
Several collections have gained new methods for inserting or pushing mutable references:
Vec::push_mutandVec::insert_mutVecDeque::push_front_mut,VecDeque::push_back_mut, andVecDeque::insert_mutLinkedList::push_front_mut
Conclusion
Rust 1.95.0 brings meaningful improvements that enhance both compile-time flexibility and runtime safety. The cfg_select! macro simplifies conditional compilation, while if-let guards make pattern matching more powerful. With dozens of stabilized APIs, this release continues Rust's commitment to providing a robust, ergonomic language for systems programming. Upgrade today and explore the new possibilities!