Fnrr2oh.putty PDocsTechnology
Related
Safari Technology Preview 243 Released with Critical VoiceOver and CSS Fixes8 Key Updates in ONLYOFFICE Docs 9.4: From Dark Spreadsheets to Licensing ClarityMicrosoft Azure in Europe: Driving Cloud and AI Innovation for a Digital FutureHow to Upgrade to React Native 0.83 and Leverage Its New Capabilities5 Underrated True-Crime Documentaries of 2025 That Put Education FirstRevitalizing Legacy System UX: A Practical Guide7 Proven Steps to Design Accessible Websites Without OverwhelmPython 3.14.3 and 3.13.12 Arrive: Key Improvements and New Features

Rust 1.95.0: Introducing cfg_select! and Enhanced Pattern Matching

Last updated: 2026-05-18 08:15:43 · Technology

Rust 1.95.0 Has Arrived

The Rust team is proud to announce the release of Rust version 1.95.0, a significant update that brings powerful new tools to the language. As always, Rust continues to empower developers to build reliable and efficient software. If you already have Rust installed via rustup, upgrading is simple:

Rust 1.95.0: Introducing cfg_select! and Enhanced Pattern Matching
Source: blog.rust-lang.org
$ rustup update stable

If you need to install rustup for the first time, visit the official download page. For those eager to test upcoming features, you can switch to the beta or nightly channels (rustup default beta or rustup default nightly) and report any bugs you encounter.

Key Features in Rust 1.95.0

The cfg_select! Macro

One of the headline additions is the cfg_select! macro, which performs compile-time branching based on configuration predicates. It functions similarly to the popular cfg-if crate but with its own syntax. The macro expands to the right-hand side of the first arm whose condition evaluates to true. This is invaluable for writing platform-specific or architecture-specific code without manually nesting cfg attributes.

Example usage:

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

let is_windows_str = cfg_select! {
    windows => "windows",
    _ => "not windows",
};

This macro simplifies conditional compilation, making your code cleaner and more maintainable.

if-let Guards in match Expressions

Building on the let chains stabilized in Rust 1.88, Rust 1.95 now allows if let guards inside match arms. This enables pattern matching combined with conditional logic directly within match clauses.

Example:

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

Note that the compiler currently does not consider patterns in if let guards for exhaustiveness checking—similar to existing if guards. This feature adds expressive power to match statements without breaking existing behavior.

Stabilized APIs

Rust 1.95.0 stabilizes a wide array of APIs, many of which improve ergonomics for MaybeUninit, Cell, and atomic types. Here’s the full list:

  • MaybeUninit<[T; N]>: From<[MaybeUninit<T>; N]>
  • MaybeUninit<[T; N]>: AsRef<[MaybeUninit<T>; N]>
  • MaybeUninit<[T; N]>: AsRef<[MaybeUninit<T>]>
  • MaybeUninit<[T; N]>: AsMut<[MaybeUninit<T>; N]>
  • MaybeUninit<[T; N]>: AsMut<[MaybeUninit<T>]>
  • [MaybeUninit<T>; N]: From<MaybeUninit<[T; N]>>
  • Cell<[T; N]>: AsRef<[Cell<T>; N]>
  • Cell<[T; N]>: AsRef<[Cell<T>]>
  • Cell<[T]>: AsRef<[Cell<T>]>
  • bool: TryFrom<{integer}>
  • AtomicPtr::update
  • AtomicPtr::try_update
  • AtomicBool::update
  • AtomicBool::try_update
  • AtomicIn::update (and try_update)
  • AtomicUn::update (and try_update)
  • cfg_select!
  • mod core::range — new module
  • core::range::RangeInclusive
  • core::range::RangeInclusiveIter
  • core::hint::cold_path
  • <*const T>::as_ref_unchecked
  • <*mut T>::as_ref_unchecked
  • <*mut T>::as_mut_unchecked
  • Vec::push_mut
  • Vec::insert_mut
  • VecDeque::push_front_mut
  • VecDeque::push_back_mut
  • VecDeque::insert_mut
  • LinkedList::push_front_mut
  • LinkedList::push_back_mut

These additions enhance type safety, performance, and ease of use for common patterns. For full details, see the official release notes.

Conclusion

Rust 1.95.0 is a substantial release that brings practical improvements like cfg_select! and if let guards, alongside many stabilized APIs. The Rust team continues to refine the language based on community feedback. Upgrade today and explore these new capabilities. As always, happy coding!