Rust 1.95.0: Introducing cfg_select! and Enhanced Pattern Matching
Rust 1.95.0 Has Arrived
The Rust team is proud to announce the release of Rust version 1.95.0, a significant update that brings powerful new tools to the language. As always, Rust continues to empower developers to build reliable and efficient software. If you already have Rust installed via rustup, upgrading is simple:

$ rustup update stable
If you need to install rustup for the first time, visit the official download page. For those eager to test upcoming features, you can switch to the beta or nightly channels (rustup default beta or rustup default nightly) and report any bugs you encounter.
Key Features in Rust 1.95.0
The cfg_select! Macro
One of the headline additions is the cfg_select! macro, which performs compile-time branching based on configuration predicates. It functions similarly to the popular cfg-if crate but with its own syntax. The macro expands to the right-hand side of the first arm whose condition evaluates to true. This is invaluable for writing platform-specific or architecture-specific code without manually nesting cfg attributes.
Example usage:
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 simplifies conditional compilation, making your code cleaner and more maintainable.
if-let Guards in match Expressions
Building on the let chains stabilized in Rust 1.88, Rust 1.95 now allows if let guards inside match arms. This enables pattern matching combined with conditional logic directly within match clauses.
Example:
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 patterns in if let guards for exhaustiveness checking—similar to existing if guards. This feature adds expressive power to match statements without breaking existing behavior.
Stabilized APIs
Rust 1.95.0 stabilizes a wide array of APIs, many of which improve ergonomics for MaybeUninit, Cell, and atomic types. Here’s the full list:
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<[T; N]>: AsRef<[Cell<T>; N]>Cell<[T; N]>: AsRef<[Cell<T>]>Cell<[T]>: AsRef<[Cell<T>]>bool: TryFrom<{integer}>AtomicPtr::updateAtomicPtr::try_updateAtomicBool::updateAtomicBool::try_updateAtomicIn::update(andtry_update)AtomicUn::update(andtry_update)cfg_select!mod core::range— new modulecore::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
These additions enhance type safety, performance, and ease of use for common patterns. For full details, see the official release notes.
Conclusion
Rust 1.95.0 is a substantial release that brings practical improvements like cfg_select! and if let guards, alongside many stabilized APIs. The Rust team continues to refine the language based on community feedback. Upgrade today and explore these new capabilities. As always, happy coding!
Related Articles
- Python 3.14.3: Key Updates and New Features Explained
- The Cognitive Cost of AI: How Outsourcing Thinking Threatens Our Judgment
- Should You Wait for the Next MacBook Pro? Key Upgrades to Consider
- Maximizing Your Pixel Watch 4: The Complete Guide to the Official USB-C Charger
- 10 Key Highlights of Incus 7.0 LTS: What You Need to Know
- How to Optimize Your KDE Plasma 6.7 Experience: Remote Desktop & Notification Tricks
- 7 Game-Changing Features in React Native 0.83 You Need to Know About
- Swift 6.3: Expanding Reach and Refining Developer Experience