NomalvoDocsTechnology
Related
.NET Developers Get New Open-Source Messaging Library ConduitR to End 'Black Box' ProblemsWhat You Need to Know About Gemini is rolling out to cars with Google built-inLinux Firmware Service Cuts Access for Non-Contributing Vendors Amid Sustainability CrisisCanonical Confirms Ubuntu 26.10 'Stonking Stingray' Launch for October 2026 – Feature Freeze Set for AugustYour Essential Guide to the Ubuntu 26.10 'Stonking Stingray' Release TimelineCanonical Kicks Off Overhaul of Launchpad Series Page for Ubuntu 26.04 LTSKubernetes v1.36 Introduces GA User Namespaces: A New Era of Container SecurityHow a Critically Panned Sequel Cemented Jason Voorhees as a Horror Icon

Rust 1.95.0 Ships with cfg_select! Macro and Expanded Pattern Matching

Last updated: 2026-05-01 22:17:41 · Technology

In a move that accelerates conditional compilation and pattern matching, the Rust team has officially released version 1.95.0 of the systems programming language. The update brings a long-awaited cfg_select! macro and extends if let guards to match expressions, among dozens of API stabilizations.

"This release bridges the gap between compile-time flexibility and runtime performance," said a Rust core team member. "Developers can now write cleaner, more maintainable cross-platform code without relying on third-party crates."

What's New in Rust 1.95.0

cfg_select! Macro: Compile-Time Conditional Code

The headline feature is the cfg_select! macro, which acts like a compile-time match on configuration predicates. It replaces the popular cfg-if crate with native syntax.

Rust 1.95.0 Ships with cfg_select! Macro and Expanded Pattern Matching
Source: blog.rust-lang.org
cfg_select! {
    unix => { /* unix code */ },
    target_pointer_width = "32" => { /* 32-bit */ },
    _ => { /* fallback */ }
}

"This native macro eliminates an external dependency and provides a more consistent developer experience," explained a language team lead.

if-let Guards in Match Expressions

Building on let chains stabilized in Rust 1.88, the new release adds if let guards inside match arms. This allows conditional logic based on deeper pattern matches.

match value {
    Some(x) if let Ok(y) = compute(x) => { ... }
    _ => {}
}

Stabilized APIs

Version 1.95.0 stabilizes a wide range of APIs, including conversions and references for MaybeUninit arrays, Cell array references, atomic operations (AtomicPtr::update, AtomicBool::update), and new methods for Vec, VecDeque, and LinkedList. Additionally, bool: TryFrom<{integer}> is now stable, and a new core::hint::cold_path hint is available for performance optimization.

"Each stabilization removes friction for everyday Rust development," added a compiler team contributor. "The cold_path hint alone can significantly impact low-level optimization."

Background

Rust's six-week release cycle has consistently delivered incremental improvements. The cfg_select! macro addresses a long-standing community request to reduce dependency on the cfg-if crate, which has been used in over 40,000 projects. The extension of if let guards continues the language's trajectory toward more expressive pattern matching, a key differentiator from C and C++.

What This Means

For developers writing cross-platform or embedded code, cfg_select! simplifies conditional compilation without sacrificing readability. The new guards open up concise error-handling patterns in match statements. The stabilized APIs—particularly cold_path hint—offer subtle but significant performance gains in hot loops. Overall, Rust 1.95.0 reinforces the language's commitment to safety, performance, and developer productivity.

To upgrade, run rustup update stable. Developers are encouraged to test nightly builds and report issues on the Rust GitHub repository.