
Rust 1.95 adds cfg_select! macro, if-let match guards, and destabilized JSON target specs
Rust 1.95 has been released, bringing several updates to this performance-focused programming language. The most notable addition is the new cfg_select! macro, which enables developers to perform compile-time conditional branching by selecting the first configuration predicate that evaluates to true. This replaces much of the use case for the well-known cfg-if crate, but introduces its own syntax.
Building on previous releases, Rust 1.95 extends let chain support to match expressions. Developers can now use let chains to express conditional pattern matching within match arms, increasing code readability and flexibility. It is important to note that the compiler does not factor these let chain patterns into the overall exhaustiveness checking—consistent with if guards behavior.
For users who rely on custom compilation targets, Rust 1.95 removes support for specifying custom target specifications with rustc on the stable toolchain. However, this change is unlikely to impact most stable users, as building the standard library still requires nightly-only features.
Alongside these primary changes, Rust 1.95 also stabilizes several APIs and introduces additional minor improvements to the language ecosystem.