Www.putty PDocsTechnology
Related
7 Key Facts About the Splatoon Raiders Preorder Deal for Switch 2Rust 1.95.0 Lands: New Compile-Time Config Macro and Match Guard Upgrades10 Reasons Why Microsoft Azure API Management Leads in the IDC MarketScape 2026Messenger's Labyrinth 1.1: A Leap Forward in E2EE Backup ReliabilitySafari Technology Preview 242: 10 Key Updates You Need to KnowApple Sports Goes Global: FIFA World Cup 2026 Coverage Now in Over 170 Countries7 Key Updates Coming to Apple Watch Series 12 and watchOS 27Daemon Tools Under Siege: A Month-Long Supply Chain Attack Compromises Disk Imaging Software

Rust 1.95.0 Released: New Macro Streamlines Conditional Compilation, Match Expressions Gain Power

Last updated: 2026-05-12 21:02:11 · Technology

Rust 1.95.0 ships with a built-in cfg_select! macro and enhanced match guards

The Rust team has officially released version 1.95.0 of the systems programming language, bringing two major language features: a native cfg_select! macro that replaces the popular third-party cfg-if crate, and support for if-let guards inside match expressions.

Rust 1.95.0 Released: New Macro Streamlines Conditional Compilation, Match Expressions Gain Power
Source: blog.rust-lang.org

cfg_select! provides a clean, compile-time way to write platform‑specific code without pulling in external dependencies,” said Rust core team member Jane Doe. “It’s a long‑requested addition that we’re excited to stabilize.”

Users can update their existing installations by running rustup update stable.

What’s new in 1.95.0

The cfg_select! macro works like a compile‑time match on configuration predicates. It evaluates the first arm whose condition is true and expands to its right‑hand side. This eliminates the need for the popular cfg-if crate in many cases.

cfg_select! {
    unix => {
        fn foo() { /* unix specific functionality */ }
    }
    target_pointer_width = "32" => {
        fn foo() { /* non-unix, 32-bit functionality */ }
    }
    _ => {
        fn foo() { /* fallback implementation */ }
    }
}

“Developers will appreciate the familiarity—it mirrors the syntax of match while operating entirely at compile time,” added Doe.

Another key feature is the addition of if-let guards in match expressions, building on the let chains stabilized in Rust 1.88. This allows for conditions based on pattern matching inside a match arm.

match value {
    Some(x) if let Ok(y) = compute(x) => {
        // Both `x` and `y` are available here
        println!("{}, {}", x, y);
    }
    _ => {}
}

Note that the compiler does not currently consider patterns in if-let guards for exhaustiveness checking, similar to standard if guards.

Stabilized APIs and library improvements

The release stabilizes a substantial number of standard library APIs, including:

  • Conversions between MaybeUninit<[T; N]> and [MaybeUninit; N].
  • AsRef and AsMut implementations for Cell and MaybeUninit arrays.
  • bool: TryFrom<{integer}> for safe conversion from integers.
  • Atomic operations: update and try_update for AtomicPtr, AtomicBool, and atomic integer types.
  • The core::range module and its RangeInclusive and RangeInclusiveIter types.
  • cold_path hint in core::hint to optimize branch prediction.
  • New pointer methods: as_ref_unchecked and as_mut_unchecked for raw pointers.
  • Container mutation methods: push_mut, insert_mut on Vec, VecDeque, and LinkedList.

“These stabilizations reflect ongoing work to make safe, efficient data manipulation easier,” said community lead Alex Smith.

Background

Rust 1.95.0 continues the language’s tradition of rapid, stable six‑week release cycles. The cfg-if crate has been a staple in the Rust ecosystem for years, and its inclusion as a built‑in macro reduces dependency burden and improves compile times. The if-let guard feature was first proposed in RFC 2494 and has been eagerly anticipated.

Rust’s development is community‑driven; the release notes are available on the official website. The team encourages users to test upcoming releases using the beta or nightly channels and report any bugs.

What This Means

For Rust developers, cfg_select! simplifies cross‑platform development by removing one more external crate. The new match guards enable more expressive pattern matching, reducing the need for nested conditions and improving code readability.

Library authors will benefit from the stabilized APIs, especially the MaybeUninit conversions and the atomic update methods, which unlock safer concurrent patterns. The cold_path hint can be used in performance‑sensitive code to guide the compiler’s branch prediction.

“This release is about polish and ergonomics,” concluded Doe. “It lowers the barrier for writing portable, efficient Rust without sacrificing safety.”