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
- GitHub Enhances Status Page with Fine-Grained Incident Reporting and Uptime Transparency
- OPay Eyes US IPO: What You Need to Know About Nigeria's Fintech Giant
- Mini PCs Signal the End of SO-DIMM: Unified Memory Takes Over
- 10 Key Facts About the New Christian Phone Network Blocking Porn and LGBTQ+ Content
- 10 Reasons You Don’t Need a Separate Vector Database for AI
- Three Major U.S. Carriers Unite to Eliminate Network Dead Zones with Satellite Tech
- Rust 1.95.0 Released: New Macro Streamlines Conditional Compilation, Match Expressions Gain Power
- Safari 26.4 Drops Major Web Technology Updates: CSS Grid Lanes, WebTransport, and Keyboard Lock API