Back
Rust 1.95: choosing an implementation at compile time
DevelopmentRustPortability

Rust 1.95: choosing an implementation at compile time

Novoid

A choice made before execution

Looking back at April: Rust 1.95, released on April 16, 2026, stabilizes cfg_select!. This macro selects the first branch whose configuration condition is true, at compile time. Rust announcement.

Make differences visible

For a library shared by a Linux server and a Windows workstation, the benefit is a clearer technical choice. Variants can be grouped around the decision that separates them. A code reviewer can then examine the intended behavior for each platform without mentally reconstructing scattered conditions. File access, paths and native integrations are plausible places to consider this approach.

Each target keeps its own contract

Selecting one branch does not prove that the others work. Compiling and testing the targets actually offered to users remains relevant, with the features enabled in the project. Before replacing existing code, also check the library’s minimum supported Rust version. Clearer syntax alone does not justify raising that requirement for every consumer. The useful change is one that makes a real platform boundary easier to maintain.