F-pattern_types : Subsets enums using as
Rust Internals [Unofficial]
March 3, 2026
To clarify, they can be used unstably, but they are very minimal. You'd need to use a macro to create them (or transmute). I tried previously, but they were just too unstable for me to really make use of.
I am saying we are a long way from them being stable, since currently, there are no plans for them to ever be stable that I am aware of.
I think the features you'd need are:
#![feature(pattern_types, rustc_attrs)]
#![feature(core_pattern_type)]
#![feature(core_pattern_types)]
#![allow(incomplete_features)]
...but it has been a while, so I might be mistaken.
Discussion in the ATmosphere