# Rust 1.95 adds configuration selection and if-let match guards

> Rust 1.95 introduces a standard configuration-selection macro and richer match guards, with a compatibility change for custom target specifications.

Canonical URL: https://www.devobs.io/news/news-rust-195-cfg-select/
By: Claire Dubois
Published: 2026-09-06T11:58:54.643Z
Updated: 2026-09-06T11:58:54.643Z
Event date: 2026-04-16
Section: Languages

Rust released version 1.95.0 on April 16, adding language conveniences for platform-specific code and conditional pattern matching. The [release announcement](https://blog.rust-lang.org/2026/04/16/Rust-1.95.0/) also flags a change that deserves attention from maintainers of custom compilation targets.

## Configuration becomes an ordered choice

The new `cfg_select!` macro selects the first branch whose configuration condition is true. Match expressions also gain `if let` guards, bringing pattern-based conditions into individual arms. These guards do not contribute to the compiler's exhaustiveness calculation.

That combination suggests two focused review tasks. For platform selection, make branch precedence obvious: an operating-system condition and a pointer-width condition can overlap. For guarded matches, retain a clear fallback instead of treating a successful inner pattern as complete coverage. A shorter expression is useful only when its behavior remains easy to inspect.

## Check the toolchain boundary

The release removes stable support for passing custom JSON target specifications to the compiler. Rust's announcement explains that building the standard library for such targets already depended on nightly features.

For an embedded or unusual-platform project, the practical question is which parts of its build were actually stable. Inventory the compiler invocation, standard-library build step, and target file together before changing the pinned version. A project using only a supported built-in target has a different migration surface from one maintaining its own target description.

Library authors adopting the new syntax should also consider their minimum compiler policy. Run the oldest supported compiler in a separate check so an incidental syntax cleanup does not silently raise downstream requirements.

## Source references

- <https://blog.rust-lang.org/2026/04/16/Rust-1.95.0/>
