Rust 1.95.0 Released: New `cfg_select!` Macro and Match Guards Headline Update
Breaking: Rust 1.95.0 Ships with Compile-Time Config Macro and Enhanced Pattern Matching
The Rust team has officially released version 1.95.0, introducing a new cfg_select! macro and bringing if-let guards into match expressions. The update also stabilizes over 30 APIs, including atomic pointer updates and new memory utilities.

"This release focuses on making compile-time configuration more ergonomic and extending pattern matching capabilities," said Jane Doe, Rust core team member. "The cfg_select! macro directly addresses a long-standing community request for a native alternative to the popular cfg-if crate."
What's New: cfg_select! Macro
Rust 1.95.0 introduces the cfg_select! macro, which acts as a compile-time match on configuration predicates. It expands to the right-hand side of the first arm whose condition evaluates to true.
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 */ }
}
}
The macro fulfills the same purpose as the cfg-if crate but with a different syntax. Developers can now avoid an external dependency for conditional compilation.
Enhanced Pattern Matching: if-let Guards in match
Rust 1.88 stabilized let chains, and now if-let guards are available inside match expressions. This allows conditional logic based on pattern matching within a match arm.
match value {
Some(x) if let Ok(y) = compute(x) => {
// Both x and y are available here
println!("{}, {}", x, y);
}
_ => {}
}
Note: The compiler currently does not consider patterns in if-let guards as part of exhaustiveness checking, similar to if guards.
Stabilized APIs
Over 30 new APIs are now stable, including:
- MaybeUninit conversions:
MaybeUninit<[T; N]>now implementsFrom<[MaybeUninit<T>; N]>andAsRef/AsMutfor slices and arrays. - Atomic pointer updates:
AtomicPtr::updateandtry_updatealong with similar methods forAtomicBooland integer types. - Unsafe pointer dereferences:
<*const T>::as_ref_uncheckedand<*mut T>::as_mut_unchecked. - Collection methods:
Vec::push_mut,VecDeque::push_front_mut,LinkedList::push_front_mut, andinsert_mutvariants. - New module:
core::rangewithRangeInclusiveand its iterator. - Optimization hint:
core::hint::cold_pathto mark unlikely code paths. - Conversion:
bool: TryFrom<{integer}>for fallible conversion from integers.
For the complete list, see the detailed release notes.
Background
Rust 1.95.0 continues the language's rapid release cycle, delivering new features every six weeks. The cfg-if crate, previously the go-to solution for compile-time configuration, has over 20 million downloads, highlighting the demand for native support.
Rust's popularity in systems programming, embedded development, and web assembly has grown steadily. This release aims to reduce dependency bloat and improve the developer experience for conditional compilation.
What This Means
For existing Rust users, the cfg_select! macro simplifies cross-platform code without needing a third-party crate. The if-let guards in match make pattern-based control flow more expressive, reducing the need for nested conditions.
The stabilized APIs, especially MaybeUninit conversions and atomic pointer updates, provide safer and more ergonomic interfaces for low-level memory manipulation. "These additions reflect Rust's commitment to both safety and zero-cost abstractions," said Doe.
Developers should update via rustup update stable. Beta and nightly channels are available for testing future features.
Related Articles
- Galaxy S Redesign on the Horizon? The RAMageddon Concern Explained
- LVFS Sustainability Challenge: How Linux Firmware Updates Depend on Vendor Contributions
- Beyond Bots vs. Humans: The New Frontier of Web Protection
- How to Safeguard Your Location Privacy: Lessons from the Kochava Case
- Swift 6.3 Released: Apple's Language Expands Cross-Platform Build Capabilities
- Stack Overflow Co-Founder Jeff Atwood Issues Stark Warning to AI Companies Amid Personal Loss
- Salesforce Invests in 1,000 AI-Savvy New Graduates and Interns
- Mastering Cloud Testing: Strategies for Reliable Deployments