Rust 1.95 adds cfg_select! macro, if-let match guards, and destabilized JSON target specs

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.

by Paul

Rust iconRust
  152
  • ...

Rust is a multi-paradigm, general-purpose programming language that prioritizes performance, type safety, and concurrency. It ensures memory safety by guaranteeing that all references point to valid memory, eliminating the need for a garbage collector. Rust's top features include static typing, type safety, and detailed compiler explanations. It is rated 4.3 and is a popular choice among developers seeking robust and efficient code.

No comments so far, maybe you want to be first?
Gu