Introduction
The Rust team has unveiled version 1.95.0 of the language, continuing its mission to empower developers to build reliable and efficient software. This release introduces two major features: a compile-time conditional macro and improved pattern matching in match expressions, along with a host of stabilized APIs that expand the standard library's capabilities.

If you already have Rust installed via rustup, updating is straightforward:
$ rustup update stable
For those new to Rust, visit the official website to get rustup. Detailed release notes for 1.95.0 are available online. Community members are encouraged to test upcoming releases by switching to the beta or nightly channels (rustup default beta or rustup default nightly) and reporting any bugs encountered.
New Compile-Time Conditional: cfg_select!
Rust 1.95.0 introduces the cfg_select! macro, which provides a clean, compile-time alternative to the popular cfg-if crate. This macro works like a match on configuration predicates, expanding to the right-hand side of the first arm whose condition evaluates to true. The syntax differs from cfg-if but remains intuitive:
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",
};
This macro is particularly useful for writing platform-specific code without relying on external crates, reducing dependencies and streamlining conditional compilation.
Enhanced Pattern Matching: if let Guards in match
Following the stabilization of let chains in Rust 1.88, version 1.95.0 extends conditional pattern matching into match expressions with if let guards. This allows you to combine pattern matching with an additional if let condition directly inside a match arm:
match value {
Some(x) if let Ok(y) = compute(x) => {
// Both x and y are available here
println!("{}, {}", x, y);
}
_ => {}
}
Note that the compiler does not currently consider patterns in if let guards when evaluating exhaustiveness—similar to how ordinary if guards are treated. This feature adds flexibility to complex matching scenarios without breaking existing checks.
Stabilized APIs in Rust 1.95.0
This release stabilizes a broad set of APIs, many of which improve ergonomics for working with MaybeUninit, atomics, collections, and raw pointers. Below is the complete list of additions:
MaybeUninit and Array Conversions
MaybeUninit<[T; N]>: From<[MaybeUninit<T>; N]>MaybeUninit<[T; N]>: AsRef<[MaybeUninit<T>; N]>MaybeUninit<[T; N]>: AsRef<[MaybeUninit<T>]>MaybeUninit<[T; N]>: AsMut<[MaybeUninit<T>; N]>MaybeUninit<[T; N]>: AsMut<[MaybeUninit<T>]>[MaybeUninit<T>; N]: From<MaybeUninit<[T; N]>>
Cell and AsRef Improvements
Cell<[T; N]>: AsRef<[Cell<T>; N]>Cell<[T; N]>: AsRef<[Cell<T>]>Cell<[T]>: AsRef<[Cell<T>]>
Atomic Operations
bool: TryFrom<{integer}>AtomicPtr::updateAtomicPtr::try_updateAtomicBool::updateAtomicBool::try_updateAtomicIn::updateAtomicIn::try_updateAtomicUn::updateAtomicUn::try_update
Additional Stabilizations
cfg_select!(macro)mod core::rangecore::range::RangeInclusivecore::range::RangeInclusiveItercore::hint::cold_path<*const T>::as_ref_unchecked<*mut T>::as_ref_unchecked<*mut T>::as_mut_uncheckedVec::push_mutVec::insert_mutVecDeque::push_front_mutVecDeque::push_back_mutVecDeque::insert_mutLinkedList::push_front_mutLinkedList::push_back_mut
Conclusion
Rust 1.95.0 continues the language's tradition of incremental, practical improvements. The cfg_select! macro simplifies compile-time conditionals, while if let guards expand pattern matching capabilities. The stabilized APIs bring more ergonomic implementations for memory initialization, atomic operations, and collection manipulation. As always, the Rust community encourages testing and feedback to help shape future releases.