Rust 1.95.0 Arrives with Native cfg_select! Macro and Smarter Pattern Matching
Breaking News: The Rust programming language released version 1.95.0 today, introducing a long-awaited cfg_select! macro and enabling if let guards inside match expressions. The update, available immediately via rustup update stable, promises cleaner compile-time conditionals and more expressive pattern matching.
What’s New in Rust 1.95.0
Native cfg_select! Macro
The headline feature is the new cfg_select! macro, which acts as a compile-time match on configuration predicates. It fills the same niche as the popular cfg-if crate but with a distinct syntax.

According to the Rust Core Team, the macro expands to the right-hand side of the first arm whose configuration predicate evaluates to true.
This allows developers to write cleaner, more readable conditional compilation blocks without relying on external crates.
if let Guards in match Expressions
Following the stabilization of let chains in Rust 1.88, version 1.95.0 brings similar capabilities into match expressions. Developers can now use if let guards to add conditionals based on pattern matching directly within match arms.
This feature allows you to extract and bind values while simultaneously testing additional conditions,
said a Rust language team representative. The compiler does not yet consider these guards in exhaustiveness checking, a limitation acknowledged in the release notes.
Stabilized APIs
Rust 1.95.0 stabilizes a broad set of APIs, including conversions and references for MaybeUninit<[T; N]>, atomic operations, and new methods for collections like Vec::push_mut.
Key additions include:
MaybeUninit<[T; N]>: NewFrom,AsRef, andAsMutimplementations.- Atomic types:
updateandtry_updatemethods forAtomicPtr,AtomicBool, and integer atomics. - Collections:
Vec::push_mut,VecDeque::push_front_mut,LinkedList::push_front_mut, and more. - New modules:
core::rangewithRangeInclusiveand its iterator. bool: TryFrom<{integer}>for safe integer-to-boolean conversion.
Additionally, the core::hint::cold_path function and unchecked pointer methods (as_ref_unchecked, as_mut_unchecked) are now stable, giving developers more control over optimization and low-level code.
Background
Rust follows a six-week release cycle, with version 1.95.0 arriving on schedule. The cfg_select! macro has been a community request for years, as the cfg-if crate became a de facto standard. By integrating it into the standard library, the Rust team reduces dependency overhead and ensures broader compatibility.
Pattern-matching improvements have been a recurring theme in recent releases, reflecting the language’s emphasis on safety and expressiveness. The addition of if let guards complements earlier work on let chains and ergonomic match syntax.
What This Means
For Rust developers, the new macro simplifies conditional compilation, making code easier to read and maintain without sacrificing performance. The pattern-matching enhancement reduces boilerplate in complex match statements, enabling more concise logic.
The API stabilizations also widen the safe functionality available in the standard library, reducing reliance on unsafe code for common operations. In particular, the atomic updates and collection mutator methods streamline concurrent and mutable data handling.
To upgrade, run rustup update stable. For those testing future releases, the beta and nightly channels are available via rustup default beta and rustup default nightly. The release notes contain full details.